lkml.org 
[lkml]   [2014]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC 03/16] kgr: initial code
Date
Jiri Slaby <jslaby@suse.cz> writes:
> OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index 1e96c3628bf2..a03b1e9d2de3 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -615,6 +615,7 @@ GLOBAL(system_call_after_swapgs)
> movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
> movq %rcx,RIP-ARGOFFSET(%rsp)
> CFI_REL_OFFSET rip,RIP-ARGOFFSET
> + movw $0, TI_kgr_in_progress+THREAD_INFO(%rsp,RIP-ARGOFFSET)

Better use 4 bytes. This has the potential to cause an expensive
Length Changing Prefixes Stall on Intel CPUs.
> +
> +static int kgr_init_ftrace_ops(const struct kgr_patch_fun *patch_fun)
> +{
> + struct kgr_loc_caches *caches;
> + unsigned long fentry_loc;
> +
> + /*
> + * Initialize the ftrace_ops->private with pointers to the fentry
> + * sites of both old and new functions. This is used as a
> + * redirection target in the per-arch stubs.
> + *
> + * Beware! -- freeing (once unloading will be implemented)
> + * will require synchronize_sched() etc.
> + */
> +
> + caches = kmalloc(sizeof(*caches), GFP_KERNEL);
> + if (!caches) {
> + kgr_debug("kgr: unable to allocate fentry caches\n");
> + return -ENOMEM;
> + }

All the error paths in this function leak memory.


-Andi
--
ak@linux.intel.com -- Speaking for myself only


\
 
 \ /
  Last update: 2014-05-01 23:21    [W:1.132 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site