[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191021090203.GA88859@gmail.com>
Date:   Mon, 21 Oct 2019 11:02:03 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org, rostedt@...dmis.org,
        mhiramat@...nel.org, bristot@...hat.com, jbaron@...mai.com,
        torvalds@...ux-foundation.org, tglx@...utronix.de,
        namit@...are.com, hpa@...or.com, luto@...nel.org,
        ard.biesheuvel@...aro.org, jpoimboe@...hat.com, jeyu@...nel.org
Subject: Re: [PATCH v4 09/16] x86/alternative: Remove text_poke_loc::len
* Ingo Molnar <mingo@...nel.org> wrote:
> 
> * Peter Zijlstra <peterz@...radead.org> wrote:
> 
> >  	 * Second step: update all but the first byte of the patched range.
> >  	 */
> >  	for (do_sync = 0, i = 0; i < nr_entries; i++) {
> > -		if (tp[i].len - sizeof(int3) > 0) {
> > +		int len = text_opcode_size(tp[i].opcode);
> > +
> > +		if (len - sizeof(int3) > 0) {
> >  			text_poke((char *)tp[i].addr + sizeof(int3),
> >  				  (const char *)tp[i].text + sizeof(int3),
> > -				  tp[i].len - sizeof(int3));
> > +				  len - sizeof(int3));
> >  			do_sync++;
> >  		}
> 
> Readability side note: 'sizeof(int3)' is a really weird way to write '1' 
> and I had to double check it's not measuring the size of some larger 
> entity.
> 
> I think it might make sense to just break out INT3_SIZE from 
> arch/x86/kernel/kprobes/opt.c into a header, rename it to INS_INT3_SIZE 
> and define it to 1, because the opt.c use is pretty obfuscated as well:
> 
>   #define INT3_SIZE sizeof(kprobe_opcode_t)
> 
> Where kprobe_opcode_t is u8 on x86 (and won't ever be anything else).
> 
> ?
Oh, the latter is done in your patch #11 already. Nice!
Thanks,
	Ingo
Powered by blists - more mailing lists
 
