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]
Date:   Mon, 10 Sep 2018 13:43:17 -0700
From:   Sean Christopherson <sean.j.christopherson@...el.com>
To:     Dave Hansen <dave.hansen@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Cc:     peterz@...radead.org, tglx@...utronix.de, x86@...nel.org,
        luto@...nel.org
Subject: Re: [RFC][PATCH 5/8] x86/mm: fix exception table comments

On Fri, 2018-09-07 at 14:51 -0700, Dave Hansen wrote:
> > 
> > > 
> > > +	 * Only do the expensive exception table search when we might be at
> > > +	 * risk of a deadlock:
> > > +	 * 1. We failed to acquire mmap_sem, and
> > > +	 * 2. The access was an explicit kernel-mode access
> > > +	 *    (X86_PF_USER=0).
> > Might be worth reminding the reader that X86_PF_USER will be set in
> > sw_error_code for implicit accesses.  I saw "explicit" and my mind
> > immediately jumped to hw_error_code for whatever reason.  E.g.:
> > 
> > 	* 2. The access was an explicit kernel-mode access (we set X86_PF_USER
> > 	*    in sw_error_code for implicit kernel-mode accesses).
> Yeah, that was not worded well.  Is this better?
> 
> > 
> >          * Only do the expensive exception table search when we might be at
> >          * risk of a deadlock:
> >          * 1. We failed to acquire mmap_sem, and
> >          * 2. The access was an explicit kernel-mode access.  An access
> >          *    from user-mode will X86_PF_USER=1 set via hw_error_code or
> >          *    set in sw_error_code if it were an implicit kernel-mode
> >          *    access that originated in user mode.

For me, mentioning hw_error_code just muddies the waters, e.g. why is
hw_error_code mentioned when it's not checked in the code?  Comments
alone won't help someone that's reading this code and doesn't understand
that hardware sets X86_PF_USER for user-mode accesses.  Maybe this?

	 * 2. The access was an explicit kernel-mode access.  X86_PF_USER
	 *    is set in sw_error_code for both user-mode accesses and
	 *    implicit kernel-mode accesses that originated in user mode.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ