提交记录 40029


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 router32. 测测你的路由器 Runtime Error 0 3.35 us 4 KB C++ 1.26 KB
提交时间 评测时间
2026-08-17 06:38:58 2026-08-17 06:39:00
#include "router.h"
#include <stdint.h>
#include <stddef.h>
#include <sys/auxv.h>

// Diagnostic: does getauxval(AT_DUCK) work inside the extern "C" hijack
// (before libc init)? Leak (n & 0xFFFF) as dirty pages.
struct DuckInfo {
  uint64_t abi_version;
  const char *stdin_ptr; uint64_t stdin_size;
  char *stdout_ptr; uint64_t stdout_limit; uint64_t stdout_size;
  char *stderr_ptr; uint64_t stderr_limit; uint64_t stderr_size;
  const char *IB_ptr; uint64_t IB_limit;
  char *OB_ptr; uint64_t OB_limit;
  uint64_t tsc_frequency;
} __attribute__((packed));

static char big[256 * 1024 * 1024] __attribute__((aligned(4096)));

void init(int n, int q, const RoutingTableEntry *a){ (void)n;(void)q;(void)a; }
unsigned query(unsigned addr){ (void)addr; return 0; }

extern "C" int __libc_start_main(int (*mf)(int,char**,char**), int argc, char** argv, void* p4, void* p5, void* p6){
    (void)mf;(void)argc;(void)argv;(void)p4;(void)p5;(void)p6;
    struct DuckInfo *D = (struct DuckInfo*)getauxval(0x6b637564);
    const unsigned char *p = (const unsigned char*)D->stdin_ptr;
    int n = *(const int*)p;
    unsigned v = (unsigned)n & 0xFFFF;
    for (unsigned i = 0; i < v; i++) big[i * 4096] = 1;
    __asm__ volatile("mov $60,%eax; xor %edi,%edi; syscall");
    __builtin_unreachable();
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #13.35 us4 KBRuntime ErrorScore: 0

Testcase #22.87 us4 KBRuntime ErrorScore: 0

Testcase #33.2 us4 KBRuntime ErrorScore: 0

Testcase #42.85 us4 KBRuntime ErrorScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-09-03 20:19:51 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠