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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170321153252.ssmrumchartuvy5m@treble>
Date:   Tue, 21 Mar 2017 10:32:52 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...nel.org, tglx@...utronix.de, hpa@...or.com,
        linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
        arjan@...ux.intel.com, bp@...en8.de, richard.weinberger@...il.com
Subject: Re: [PATCH 1/5] x86: Implement __WARN using UD0

On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote:
> > to WARN, they should probably be renamed to describe their new purpose,
> > like:
> > 
> >   "report_bug" -> "report_bug_or_warning"
> >   "fixup_bug"  -> "fixup_bug_or_warning"
> > 
> > On a related note, if warn and bug are going to continue to use two
> > separate ud instructions for the foreseeable future, report_bug() could
> > be cleaned up a bit: e.g., for a ud0 instruction, it doesn't make sense
> > to call find_bug().
> 
> I'm sure you'll break $random arch if you go futz with that. Also, I
> think you mean UD2, since that's BUG. We actually need the bug_entry for
> WARNs (aka UD0).
> 
> Also, you're now optimizing the BUG() code; I don't think anybody cares
> about saving a few cycles there. It shouldn't happen in the first place.

My thinking was to make report_bug() a little less obtuse, but yeah,
that would break other arches, so never mind...

> > > +static int fixup_bug(struct pt_regs *regs, int trapnr)
> > > +{
> > > +	if (trapnr != X86_TRAP_UD)
> > > +		return 0;
> > > +
> > > +	switch (report_bug(regs->ip, regs)) {
> > > +	case BUG_TRAP_TYPE_NONE:
> > > +	case BUG_TRAP_TYPE_BUG:
> > > +		break;
> > > +
> > > +	case BUG_TRAP_TYPE_WARN:
> > > +		regs->ip += 2;
> > > +		return 1;
> > 
> > For self-documentation purposes, maybe use a define for the length of
> > the ud0 instruction?
> 
> Well, UD0 and UD2 really. LENGTH_UD0_OR_UD2 is a bit of a fail, name
> wise.

Why UD2?  Warnings are UD0-only, no?  What about UD0_LEN?  Or at least a
comment would be helpful I think.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ