lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 2 May 2019 22:18:12 +0200
From:   Daniel Bristot de Oliveira <bristot@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        "Steven Rostedt (VMware)" <rostedt@...dmis.org>,
        Jiri Kosina <jkosina@...e.cz>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Chris von Recklinghausen <crecklin@...hat.com>,
        Jason Baron <jbaron@...mai.com>, Scott Wood <swood@...hat.com>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Clark Williams <williams@...hat.com>, x86@...nel.org
Subject: Re: [PATCH V5 7/7] x86/jump_label: Batch jump label updates

On 4/15/19 1:54 PM, Peter Zijlstra wrote:
> So how about we do something like:
> 
> +static struct bp_patching_desc {
> +       int nr_entries;
> +       struct text_patch_loc vec[PAGE_SIZE / sizeof(struct text_patch_loc)];
> +} bp_patching;
> 
> and call it a day?
> 
> Then we have static storage, no allocation, no fail paths.
> 
> Also note that I removed that whole in_progress thing, as that is
> completely redudant vs !!nr_entries.

Hi Peter,

I am finishing the next version, but now I am in a dilemma.

If I use:

static struct bp_patching_desc {
	int nr_entries;
	struct text_patch_loc vec[PAGE_SIZE / sizeof(struct text_patch_loc)];
} bp_patching;

The in_progress is still needed because nr_entries will increase while
queuing... and so we would enter in the int3 before we actually need.

It will also need a new function on alternative.c to queue each entry into the
vector and change the text_poke_bp_batch() to a text_poke_bp_apply() without
arguments, +- replicating the arch_jump_label_transform_queue() and
arch_jump_label_transform_apply().

[ and probably also take the text_mutex while queuing... and release in the apply ]

OR

I can declare a vector and a counter in arch/x86/jump_label.c, like this:

#define TP_VEC_MAX (PAGE_SIZE / sizeof(struct text_patch_loc))
static struct text_patch_loc tp_vec[TP_VEC_MAX];
int tp_nr_entries = 0;

and use the arch_jump_label_transform_batch() as it is now, i.e:

void text_poke_bp_batch(struct text_patch_loc *tp, unsigned int nr_entries)

In this case, we do not need the in_progress because the
bp_patching_desc.nr_entries is filled only when in progress.

so, which path should I take?

Thanks
-- Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ