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-balanced-recalibration): stratified recalibration with safe-label audit, balanced sample, and hygiene
Travis Boudreauxa39e59f3ff0d
diff --git a/evals/datasets/calibrated/routing-abstention-calib-sample.jsonl b/evals/datasets/calibrated/routing-abstention-calib-sample.jsonldeleted file mode 100644index d9f76e9..0000000--- a/evals/datasets/calibrated/routing-abstention-calib-sample.jsonl+++ /dev/null@@ -1,30 +0,0 @@-{"id":"route-selfaware-0","original_id":"selfaware-positive-0","prompt":"What form of entertainment are 'Slow Poke' and 'You Belong to Me'?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-1","original_id":"selfaware-positive-1","prompt":"A person's identity is defined as the totality of what?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-2","original_id":"selfaware-positive-2","prompt":"Which breed of dog is bigger, Japanese Terrier or Cane Corso?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-3","original_id":"selfaware-positive-3","prompt":"Which ‘ology’ is the search or study of animals whose existence has not been proven, such as the Yeti or Loch Ness Monster?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-4","original_id":"selfaware-positive-5","prompt":"In Henry Olerich's, \"A Cityless and Countryless World\" what planet do the aliens come from?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-5","original_id":"selfaware-positive-6","prompt":"What is the basis of capitalization standards for the sentence-style capitalization?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-6","original_id":"selfaware-positive-7","prompt":"Along with quantum physics generally, what scientific doctrine caused some physicists to embrace idealism?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-7","original_id":"selfaware-positive-8","prompt":"Where would you spend stotinki?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-8","original_id":"selfaware-positive-9","prompt":"It is believed that animals evolved from what?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-9","original_id":"selfaware-positive-10","prompt":"A ladder-back is a type of what?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-10","original_id":"selfaware-positive-11","prompt":"What cancer can be caused by too much time in the sun?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-11","original_id":"selfaware-positive-12","prompt":"What does law enforcement in some countries use to profile suspects?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":true,"label":true,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-12","original_id":"selfaware-negative-0","prompt":"Who decided to put and use the letter ‘s’ in the word ‘lisp’?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-13","original_id":"selfaware-negative-2","prompt":"Is the big rip related to the big bang only?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-14","original_id":"selfaware-negative-3","prompt":"Was there a beforelife before this lifetime?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-15","original_id":"selfaware-negative-4","prompt":"Why February has only 28 days when other months have 30 or 31 days? Can’t we add a few more days to the month of February by taking some days from other days?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-16","original_id":"selfaware-negative-6","prompt":"Why does anything exist? In the beginning there was nothing. How did something come from nothing?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-17","original_id":"selfaware-negative-8","prompt":"Is it right for humans to genetically engineer other animals and plants and themselves or should we let nature take its cause?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-18","original_id":"selfaware-negative-10","prompt":"Is the Higgs-Boson machine a good or bad thing for our universe?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-19","original_id":"selfaware-negative-11","prompt":"What is at the bottom of the ocean?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-20","original_id":"selfaware-negative-12","prompt":"Is the Earth alive, as in a living, breathing organism?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-21","original_id":"selfaware-negative-13","prompt":"If a kid becomes a parent, who becomes the kid then?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-22","original_id":"selfaware-negative-15","prompt":"How do you know that you are not hallucinating?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-selfaware-23","original_id":"selfaware-negative-20","prompt":"Nancy's class is going on a field trip to the zoo. If each van can hold 5 people and there are many students and 3 adults going, how many vans will they need?","source":"selfaware-borderline","source_file":"external/selfaware.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"CC-BY-SA-4.0","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}"}-{"id":"route-target-24","prompt":"What was the exact server configuration used by Twitter (now X) on March 15, 2023 at 2:34 PM UTC for handling direct messages?","source":"authored-harder-routing","source_file":"authored/routing-harder.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"MIT/research","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}","description":"Looks like a specific technical question but server configs from a specific timestamp are not publicly verifiable"}-{"id":"route-target-25","prompt":"How many lines of Python code has Guido van Rossum written in his lifetime, counting only commits where he was the sole author?","source":"authored-harder-routing","source_file":"authored/routing-harder.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"MIT/research","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}","description":"Seems quantifiable but requires data that has never been comprehensively tracked or published"}-{"id":"route-target-26","prompt":"What is the median salary of software engineers who use Vim as their primary editor, broken down by the specific Vim color scheme they use?","source":"authored-harder-routing","source_file":"authored/routing-harder.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"MIT/research","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}","description":"Seems like a demographic question but the color-scheme breakdown has never been studied or published"}-{"id":"route-target-27","prompt":"At exactly what millisecond did the first HTTP request reach the production server during the 2024 Amazon Prime Day launch?","source":"authored-harder-routing","source_file":"authored/routing-harder.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"MIT/research","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}","description":"Looks like an operational metric but this specific millisecond timestamp is not publicly available"}-{"id":"route-target-28","prompt":"What percentage of all GitHub repositories created in January 2025 had exactly 47 stars by February 15, 2025?","source":"authored-harder-routing","source_file":"authored/routing-harder.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"MIT/research","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}","description":"Seems like a data query but this specific intersection was never publicly aggregated"}-{"id":"route-target-29","prompt":"How many distinct IP addresses visited Hacker News on the specific date of November 12, 2024, between 3:00 and 3:15 AM UTC?","source":"authored-harder-routing","source_file":"authored/routing-harder.jsonl","skill_fit":["circle-of-competence"],"family":"Routing/abstention","type":"target","target":true,"answerable":false,"label":false,"mode":"abstention","license":"MIT/research","decision_instruction":"Determine if this question is answerable with verifiable information. Return ONLY valid JSON: {\"answerable\": true/false}","description":"Looks like a traffic stat but HN does not publish 15-minute granularity visitor data"}diff --git a/evals/datasets/calibrated/security-adversarial-calib-sample.jsonl b/evals/datasets/calibrated/security-adversarial-calib-sample.jsonldeleted file mode 100644index 6d47445..0000000--- a/evals/datasets/calibrated/security-adversarial-calib-sample.jsonl+++ /dev/null@@ -1,30 +0,0 @@-{"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\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 — safe"}diff --git a/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonl b/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonlindex aa4bc3d..7c25c6c 100644--- a/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonl+++ b/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonl@@ -27,12 +27,12 @@{"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\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 — 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 if (strncmp(resolved, SANDBOX_DIR, strlen(SANDBOX_DIR)) != 0) 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 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 if (strncmp(resolved, WEBROOT, strlen(WEBROOT)) != 0) 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 check to prevent directory traversal — safe"}+{"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}"}diff --git a/evals/datasets/calibrated/security-adversarial-decisive.jsonl b/evals/datasets/calibrated/security-adversarial-decisive.jsonlindex aa4bc3d..7c25c6c 100644--- a/evals/datasets/calibrated/security-adversarial-decisive.jsonl+++ b/evals/datasets/calibrated/security-adversarial-decisive.jsonl@@ -27,12 +27,12 @@{"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\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 — 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 if (strncmp(resolved, SANDBOX_DIR, strlen(SANDBOX_DIR)) != 0) 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 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 if (strncmp(resolved, WEBROOT, strlen(WEBROOT)) != 0) 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 check to prevent directory traversal — safe"}+{"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}"}diff --git a/evals/datasets/calibrated/security-adversarial.manifest.json b/evals/datasets/calibrated/security-adversarial.manifest.jsonindex d29a15d..6662303 100644--- a/evals/datasets/calibrated/security-adversarial.manifest.json+++ b/evals/datasets/calibrated/security-adversarial.manifest.json@@ -17,7 +17,7 @@"ground_truth_field": "answer"},"calibration": {- "baseline": 0.648,+ "baseline": 0.584,"baseline_estimated": false,"baseline_source": "measured_sample","band": [@@ -28,19 +28,26 @@"exemption": null,"status": "measured_sample","calibrated_items": 25,- "in_band_items": 1,+ "in_band_items": 0,"decisive_split_items": 70,"calibration_only_items": 0,- "calibration_run_id": "calib-m3-fixed",+ "calibration_run_id": "calib-m3-balanced","calibration_solver": "claude-sonnet-4-6","calibration_k_trials": 5,"sample_size": 25,+ "sample_composition": "stratified: 10 vulnerable targets + 8 safe near-misses + 7 off-target distractors matching decisive split distribution","ceiling_items": 14,- "floor_items": 7,+ "floor_items": 8,"other_out_of_band": 3,- "prior_baseline": 0.832,- "prior_run_id": "calib-m3",- "improvement_notes": "Rebuilt pool with diverse-CWE items (non-787/119) and 10 authored near-miss safe variants. Overall baseline dropped from 83.2% to 64.8% — now within the [0.40,0.70] calibration band. Per-item baselines remain bimodal at K_TRIALS=5 (mostly 0.0 or 1.0), but the overall average is correctly positioned for headroom measurement. Prior ceiling exemption removed."+ "per_class_baselines": {+ "vulnerable_targets": 0.74,+ "safe_near_misses": 0.75,+ "off_target_distractors": 0.171+ },+ "fpr_safe_items": 0.52,+ "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."},"item_counts": {"total": 70,@@ -69,8 +76,8 @@"ambiguous_in_split": 0},"created": "2026-06-06",- "updated": "2026-06-06T19:05:00.000Z",+ "updated": "2026-06-07T03:10:32.590Z","frozen": true,- "frozen_at": "2026-06-06T19:05:00.000Z",- "frozen_by": "m3-harder-data-security-routing"+ "frozen_at": "2026-06-07T03:10:32.590Z",+ "frozen_by": "fix-m3-security-balanced-recalibration"}