type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \
structs
struct skcipher_sg_list { struct list_head list; int cur; struct scatterlist sg[0]; };
structs
struct skcipher_ctx { struct list_head tsgl; struct af_alg_sgl rsgl; void *iv; struct af_alg_completion completion; atomic_t inflight; size_t used; unsigned int len; bool more; bool merge; bool enc; struct skcipher_request req; };
structs
struct skcipher_async_rsgl { struct af_alg_sgl sgl; struct list_head list; };
structs
struct skcipher_async_req { struct kiocb *iocb; struct skcipher_async_rsgl first_sgl; struct list_head list; struct scatterlist *tsg; char iv[]; };
functions
void skcipher_free_async_sgls(struct skcipher_async_req *sreq) { struct skcipher_async_rsgl *rsgl, *tmp; struct scatterlist *sgl; struct scatterlist *sg; int i, n; list_for_each_entry_safe(rsgl, tmp, &sreq->list, list) { af_alg_free_sg(&rsgl->sgl); if (rsgl != &sreq->first_sgl) kfree(rsgl); }
functions
void skcipher_async_cb(struct crypto_async_request *req, int err) { struct sock *sk = req->data; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct skcipher_async_req *sreq = GET_SREQ(req, ctx); struct kiocb *iocb = sreq->iocb; atomic_dec(&ctx->inflight); skcipher_free_async_sgls...
functions
int skcipher_sndbuf(struct sock *sk) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; return max_t(int, max_t(int, sk->sk_sndbuf & PAGE_MASK, PAGE_SIZE) - ctx->used, 0); }
functions
bool skcipher_writable(struct sock *sk) { return PAGE_SIZE <= skcipher_sndbuf(sk); }
functions
int skcipher_alloc_sgl(struct sock *sk) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct skcipher_sg_list *sgl; struct scatterlist *sg = NULL; sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list); if (!list_empty(&ctx->tsgl)) sg = sgl->sg; if (!sg || sgl->cur >=...
functions
void skcipher_pull_sgl(struct sock *sk, size_t used, int put) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct skcipher_sg_list *sgl; struct scatterlist *sg; int i; while (!list_empty(&ctx->tsgl)) { sgl = list_first_entry(&ctx->tsgl, struct skcipher_sg_list, list)...
functions
void skcipher_free_sgl(struct sock *sk) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; skcipher_pull_sgl(sk, ctx->used, 1); }
functions
int skcipher_wait_for_wmem(struct sock *sk, unsigned flags) { long timeout; DEFINE_WAIT(wait); int err = -ERESTARTSYS; if (flags & MSG_DONTWAIT) return -EAGAIN; sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); for (;;) { if (signal_pending(current)) break; prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE)...
functions
void skcipher_wmem_wakeup(struct sock *sk) { struct socket_wq *wq; if (!skcipher_writable(sk)) return; rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (skwq_has_sleeper(wq)) wake_up_interruptible_sync_poll(&wq->wait, POLLIN | POLLRDNORM | POLLRDBAND); sk_wake_async(sk, SOCK_WAKE_WAI...
functions
int skcipher_wait_for_data(struct sock *sk, unsigned flags) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; long timeout; DEFINE_WAIT(wait); int err = -ERESTARTSYS; if (flags & MSG_DONTWAIT) { return -EAGAIN; }
functions
void skcipher_data_wakeup(struct sock *sk) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct socket_wq *wq; if (!ctx->used) return; rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (skwq_has_sleeper(wq)) wake_up_interruptible_sync_poll(&wq->wait, POLLOUT | P...
functions
int skcipher_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(&ctx->req); unsigned ivsize = crypto_skcipher_ivsize(tfm); struct skciphe...
functions
ssize_t skcipher_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct skcipher_sg_list *sgl; int err = -EINVAL; if (flags & MSG_SENDPAGE_NOTLAST) flags |= MSG_MO...
functions
int skcipher_all_sg_nents(struct skcipher_ctx *ctx) { struct skcipher_sg_list *sgl; struct scatterlist *sg; int nents = 0; list_for_each_entry(sgl, &ctx->tsgl, list) { sg = sgl->sg; while (!sg->length) sg++; nents += sg_nents(sg); }
functions
int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg, int flags) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct skcipher_sg_list *sgl; struct scatterlist *sg; struct skcipher_async_req *sreq; struct skcipher_request *req; stru...
functions
int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg, int flags) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; unsigned bs = crypto_skcipher_blocksize(crypto_skcipher_reqtfm( &ctx->req)); struct skcipher_sg_list *sgl; struct scatterli...
functions
int skcipher_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored, int flags) { return (msg->msg_iocb && !is_sync_kiocb(msg->msg_iocb)) ? skcipher_recvmsg_async(sock, msg, flags) : skcipher_recvmsg_sync(sock, msg, flags); }
functions
int skcipher_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; unsigned int mask; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; if (ctx->used) mask |= POLLIN | POLLRDNORM; if (...
functions
void skcipher_release(void *private) { crypto_free_skcipher(private); }
functions
int skcipher_setkey(void *private, const u8 *key, unsigned int keylen) { return crypto_skcipher_setkey(private, key, keylen); }
functions
void skcipher_wait(struct sock *sk) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; int ctr = 0; while (atomic_read(&ctx->inflight) && ctr++ < 100) msleep(100); }
functions
void skcipher_sock_destruct(struct sock *sk) { struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(&ctx->req); if (atomic_read(&ctx->inflight)) skcipher_wait(sk); skcipher_free_sgl(sk); sock_kzfree_s(sk, ctx->iv, crypto_skcipher_ivsi...
functions
int skcipher_accept_parent(void *private, struct sock *sk) { struct skcipher_ctx *ctx; struct alg_sock *ask = alg_sk(sk); unsigned int len = sizeof(*ctx) + crypto_skcipher_reqsize(private); ctx = sock_kmalloc(sk, len, GFP_KERNEL); if (!ctx) return -ENOMEM; ctx->iv = sock_kmalloc(sk, crypto_skcipher_ivsize(pri...
functions
__init algif_skcipher_init(void) { return af_alg_register_type(&algif_type_skcipher); }
functions
__exit algif_skcipher_exit(void) { int err = af_alg_unregister_type(&algif_type_skcipher); BUG_ON(err); }
includes
#include <stdio.h>
includes
#include <getopt.h>
includes
#include <stdlib.h>
includes
#include <netinet/in.h>
includes
#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
defines
#define IPPROTO_UDPLITE 136
defines
#define UDP_OPT_MAX 11
defines
#define UDPLITE_VALID_FLAGS_MAX 2
functions
void help(void) { fprintf(stdout, " --orig-port-src\t\toriginal source port\n"); fprintf(stdout, " --orig-port-dst\t\toriginal destination port\n"); fprintf(stdout, " --reply-port-src\t\treply source port\n"); fprintf(stdout, " --reply-port-dst\t\treply destination port\n"); fprintf(stdout, " --mask-port-src\...
functions
int parse_options(char c, struct nf_conntrack *ct, struct nf_conntrack *exptuple, struct nf_conntrack *mask, unsigned int *flags) { switch(c) { u_int16_t port; case '1': port = htons(atoi(optarg)); nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port); nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_...
functions
void final_check(unsigned int flags, unsigned int cmd, struct nf_conntrack *ct) { int ret, partial; ret = generic_opt_check(flags, UDP_OPT_MAX, udplite_commands_v_options[cmd], udplite_optflags, udplite_valid_flags, UDPLITE_VALID_FLAGS_MAX, &partial); if (!ret) { switch(partial) { case -1: cas...
functions
void register_udplite(void) { register_proto(&udplite); }
functions
void pci_config_writel(u16 bdf, u32 addr, u32 val) { outl(0x80000000 | (bdf << 8) | (addr & 0xfc), PORT_PCI_CMD); outl(val, PORT_PCI_DATA); }
functions
void pci_config_writew(u16 bdf, u32 addr, u16 val) { outl(0x80000000 | (bdf << 8) | (addr & 0xfc), PORT_PCI_CMD); outw(val, PORT_PCI_DATA + (addr & 2)); }
functions
void pci_config_writeb(u16 bdf, u32 addr, u8 val) { outl(0x80000000 | (bdf << 8) | (addr & 0xfc), PORT_PCI_CMD); outb(val, PORT_PCI_DATA + (addr & 3)); }
functions
u32 pci_config_readl(u16 bdf, u32 addr) { outl(0x80000000 | (bdf << 8) | (addr & 0xfc), PORT_PCI_CMD); return inl(PORT_PCI_DATA); }
functions
u16 pci_config_readw(u16 bdf, u32 addr) { outl(0x80000000 | (bdf << 8) | (addr & 0xfc), PORT_PCI_CMD); return inw(PORT_PCI_DATA + (addr & 2)); }
functions
u8 pci_config_readb(u16 bdf, u32 addr) { outl(0x80000000 | (bdf << 8) | (addr & 0xfc), PORT_PCI_CMD); return inb(PORT_PCI_DATA + (addr & 3)); }
functions
void pci_config_maskw(u16 bdf, u32 addr, u16 off, u16 on) { u16 val = pci_config_readw(bdf, addr); val = (val & ~off) | on; pci_config_writew(bdf, addr, val); }
functions
int pci_next(int bdf, int *pmax) { if (pci_bdf_to_fn(bdf) == 1 && (pci_config_readb(bdf-1, PCI_HEADER_TYPE) & 0x80) == 0) // Last found device wasn't a multi-function device - skip to // the next device. bdf += 7; int max = *pmax; for (;;) { if (bdf >= max) { ...
functions
int pci_find_vga(void) { int bdf = 0x0000, max = 0x0100; for (;;) { if (bdf >= max) { if (CONFIG_PCI_ROOT1 && bdf <= (CONFIG_PCI_ROOT1 << 8)) bdf = CONFIG_PCI_ROOT1 << 8; else if (CONFIG_PCI_ROOT2 && bdf <= (CONFIG_PCI_ROOT2 << 8)) bdf = CONFIG_PCI...
functions
int pci_find_device(u16 vendid, u16 devid) { u32 id = (devid << 16) | vendid; int bdf, max; foreachpci(bdf, max) { u32 v = pci_config_readl(bdf, PCI_VENDOR_ID); if (v == id) return bdf; }
functions
int pci_find_class(u16 classid) { int bdf, max; foreachpci(bdf, max) { u16 v = pci_config_readw(bdf, PCI_CLASS_DEVICE); if (v == classid) return bdf; }
functions
int pci_init_device(const struct pci_device_id *ids, u16 bdf, void *arg) { u16 vendor_id = pci_config_readw(bdf, PCI_VENDOR_ID); u16 device_id = pci_config_readw(bdf, PCI_DEVICE_ID); u16 class = pci_config_readw(bdf, PCI_CLASS_DEVICE); while (ids->vendid || ids->class_mask) { if ((ids->vendid =...
defines
#define CORE_EVNTSEL_EVENT_MASK 0x000000FFULL
defines
#define CORE_EVNTSEL_UNIT_MASK 0x0000FF00ULL
defines
#define CORE_EVNTSEL_EDGE_MASK 0x00040000ULL
defines
#define CORE_EVNTSEL_INV_MASK 0x00800000ULL
defines
#define CORE_EVNTSEL_REG_MASK 0xFF000000ULL
defines
#define CORE_EVNTSEL_MASK \
structs
struct bts_record { u64 from; u64 to; u64 flags; };
functions
u64 intel_pmu_event_map(int hw_event) { return intel_perfmon_event_map[hw_event]; }
functions
u64 intel_pmu_raw_event(u64 hw_event) { (INTEL_ARCH_EVTSEL_MASK | \ INTEL_ARCH_UNIT_MASK | \ INTEL_ARCH_EDGE_MASK | \ INTEL_ARCH_INV_MASK | \ INTEL_ARCH_CNT_MASK) return hw_event & CORE_EVNTSEL_MASK; }
functions
void intel_pmu_enable_bts(u64 config) { unsigned long debugctlmsr; debugctlmsr = get_debugctlmsr(); debugctlmsr |= X86_DEBUGCTL_TR; debugctlmsr |= X86_DEBUGCTL_BTS; debugctlmsr |= X86_DEBUGCTL_BTINT; if (!(config & ARCH_PERFMON_EVENTSEL_OS)) debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS; if (!(config & ARCH_PERFM...
functions
void intel_pmu_disable_bts(void) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); unsigned long debugctlmsr; if (!cpuc->ds) return; debugctlmsr = get_debugctlmsr(); debugctlmsr &= ~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT | X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR)...
functions
void intel_pmu_disable_all(void) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0); if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) intel_pmu_disable_bts(); }
functions
void intel_pmu_enable_all(void) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl); if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) { struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS]; if (WARN_ON_ONCE(!event)) return;...
functions
u64 intel_pmu_get_status(void) { u64 status; rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status); return status; }
functions
void intel_pmu_ack_status(u64 ack) { wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack); }
functions
void intel_pmu_disable_fixed(struct hw_perf_event *hwc) { int idx = hwc->idx - X86_PMC_IDX_FIXED; u64 ctrl_val, mask; mask = 0xfULL << (idx * 4); rdmsrl(hwc->config_base, ctrl_val); ctrl_val &= ~mask; (void)checking_wrmsrl(hwc->config_base, ctrl_val); }
functions
void intel_pmu_drain_bts_buffer(void) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); struct debug_store *ds = cpuc->ds; struct bts_record { u64 from; u64 to; u64 flags; }
functions
void intel_pmu_disable_event(struct perf_event *event) { struct hw_perf_event *hwc = &event->hw; if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) { intel_pmu_disable_bts(); intel_pmu_drain_bts_buffer(); return; }
functions
void intel_pmu_enable_fixed(struct hw_perf_event *hwc) { int idx = hwc->idx - X86_PMC_IDX_FIXED; u64 ctrl_val, bits, mask; int err; /* * Enable IRQ generation (0x8), * and enable ring-3 counting (0x2) and ring-0 counting (0x1) * if requested: */ bits = 0x8ULL; if (hwc->config & ARCH_PERFMON_EVENTSEL_USR)...
functions
void intel_pmu_enable_event(struct perf_event *event) { struct hw_perf_event *hwc = &event->hw; if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) { if (!__get_cpu_var(cpu_hw_events).enabled) return; intel_pmu_enable_bts(hwc->config); return; }
functions
int intel_pmu_save_and_restart(struct perf_event *event) { x86_perf_event_update(event); return x86_perf_event_set_period(event); }
functions
void intel_pmu_reset(void) { struct debug_store *ds = __get_cpu_var(cpu_hw_events).ds; unsigned long flags; int idx; if (!x86_pmu.num_events) return; local_irq_save(flags); printk("clearing PMU state on CPU#%d\n", smp_processor_id()); for (idx = 0; idx < x86_pmu.num_events; idx++) { checking_wrmsrl(x86_p...
functions
int intel_pmu_handle_irq(struct pt_regs *regs) { struct perf_sample_data data; struct cpu_hw_events *cpuc; int bit, loops; u64 ack, status; perf_sample_data_init(&data, 0); cpuc = &__get_cpu_var(cpu_hw_events); intel_pmu_disable_all(); intel_pmu_drain_bts_buffer(); status = intel_pmu_get_status(); if (!sta...
functions
int intel_pmu_init(void) { union cpuid10_edx edx; union cpuid10_eax eax; unsigned int unused; unsigned int ebx; int version; if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { /* check for P6 processor family */ if (boot_cpu_data.x86 == 6) { return p6_pmu_init(); }
functions
int intel_pmu_init(void) { return 0; }
includes
#include <hurd.h>
includes
#include <hurd/id.h>
includes
#include <string.h>
functions
int geteuids (int n, uid_t *uidset) { error_t err; int nuids; void *crit; crit = _hurd_critical_section_lock (); __mutex_lock (&_hurd_id.lock); if (err = _hurd_check_ids ()) { __mutex_unlock (&_hurd_id.lock); _hurd_critical_section_unlock (crit); return __hurd_fail (err); }
defines
#define MAIN_FILE
defines
#define CHILLI_USER "chilli"
defines
#define CHILLI_GROUP "chilli"
functions
void usage(char *prog) { fprintf(stderr,"%s chilli-bin script-path [script-arguments]\n", prog); exit(-1); }
main
int main(int argc, char **argv) { struct stat statbuf; uid_t uid = getuid(); uid_t gid = getgid(); uid_t euid = geteuid(); uid_t egid = getegid(); struct passwd * pwd = getpwuid(uid); struct group * grp = getgrgid(gid); if (argc < 3) usage(argv[0]); options_init(); openlog(PACKAGE, LOG_P...
includes
#include <tcmi/comm/tcmi_messages_dsc.h>
includes
#include <tcmi/syscall/tcmi_shadow_rpc.h>
includes
#include <tcmi/comm/tcmi_rpc_procmsg.h>
includes
#include <tcmi/comm/tcmi_rpcresp_procmsg.h>
includes
#include <tcmi/comm/tcmi_ppm_p_migr_back_shadowreq_procmsg.h>
includes
#include <tcmi/manager/tcmi_migman.h>
includes
#include <tcmi/migration/tcmi_npm_params.h>
includes
#include <asm/signal.h>
includes
#include <proxyfs/proxyfs_server.h>
includes
#include <director/director.h>
defines
#define TCMI_SHADOWTASK_PRIVATE
functions
void tcmi_shadowtask_signal_handler(int sig) { mdbg(ERR3, "Shadow signal handler for signal %d called", sig); }