Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1821471imm; Fri, 6 Jul 2018 07:08:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc50JmDsc0wjeKyUB50ilKTuibKKCYaAc4cn+Ok5+jb6bdb3z0+YWzjmoiavGX+MMjADNRo X-Received: by 2002:a63:6c05:: with SMTP id h5-v6mr3600725pgc.367.1530886083522; Fri, 06 Jul 2018 07:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530886083; cv=none; d=google.com; s=arc-20160816; b=XyVPXRQGsB86VUslEfbEiz2cDrrTk+w25R/+p5kxHTK3X3hhm/GcOuQ89+dNjrr7ZP lkTUIkyFx09xL3qTDbWC/00YHatGSB2m++52+TWv4YWwiYssCsD5e5aodF90Jv4fkmXx vaAWF+OJfc+4CQUfP5D8K60GCzcBG6Gba9eyD66b7/XtGrXhKb3GDtiQvyMH9HqyoBwF YdcLLIEwqWewi2QpTVZb2iR7/uMrH/kwJXMRid4oRAFpqhka8u7rX6yOtIVjjDS49SvJ ET45Umj526P548Ps53hF89WA/mbvGifGoGg0S3Z+mpSxGV/UsSxnltQga2oFJlBCgZNK /1QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ewbG+9P4HtVR7gzZk0IeXZ+ztenKkUfntk9g/VSxHHM=; b=bW6plm86zVFMagAgOEWKt8mXTUBnPjnTg+mQ4bCdGBBF2b4lzD0qpFrKXy+nZ+tO9D P9aLyxpKG0G8yDbZJxLO98YA8iKO5i2LxDy45iEF3NhPlGpErTgFu3yXzVmKlyfp95Gd 5xgZkpssx/KkdWmef95NzFfGBIIhfdkN7oaorVk4QNn9wwEYZr+DyC1aldrxDvCjK5TZ p6yxdAdobmGSSouDxIf+3b5+Tm21TvhSP0Bu+0wLRBg5BUtFEJ/hLLjMmSet7w66GDSs Gaa0iGxMTb8250KbkmXKpRyUmTKg5w+PmWUkUph9ZtslDIVLxhTBC+YDa5Tu4IUake6W tF9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si8401856plb.246.2018.07.06.07.07.48; Fri, 06 Jul 2018 07:08:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932766AbeGFOGu (ORCPT + 99 others); Fri, 6 Jul 2018 10:06:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41168 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753630AbeGFOGt (ORCPT ); Fri, 6 Jul 2018 10:06:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D0787264E; Fri, 6 Jul 2018 14:06:48 +0000 (UTC) Received: from treble (ovpn-123-143.rdu2.redhat.com [10.10.123.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 868BA111DD00; Fri, 6 Jul 2018 14:06:45 +0000 (UTC) Date: Fri, 6 Jul 2018 09:06:43 -0500 From: Josh Poimboeuf To: Ingo Molnar Cc: Alexey Dobriyan , Borislav Petkov , linux-crypto@vger.kernel.org, Mike Galbraith , torvalds@linux-foundation.org, tglx@linutronix.de, luto@kernel.org, peterz@infradead.org, brgerst@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org, dvlasenk@redhat.com, h.peter.anvin@intel.com, linux-tip-commits , Herbert Xu , Peter Zijlstra Subject: Re: [PATCH] x86/crypto: Add missing RETs Message-ID: <20180706140643.u2vau63nncg23hmi@treble> References: <20180617194747.GA21160@zn.tnic> <1529289279.31745.3.camel@gmx.de> <20180623103622.GA2760@zn.tnic> <20180624071105.GA29407@gmail.com> <20180624104449.GA20159@avx2> <20180625072438.GA19063@gmail.com> <20180625131932.sge43esxdb5ejoxg@treble> <20180626064930.GB25879@gmail.com> <20180626123154.unjji5glpokedwal@treble> <20180705075815.GA20903@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180705075815.GA20903@gmail.com> User-Agent: NeoMutt/20180323 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 06 Jul 2018 14:06:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 06 Jul 2018 14:06:48 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 05, 2018 at 09:58:15AM +0200, Ingo Molnar wrote: > > * Josh Poimboeuf wrote: > > > > So that's still incomplete in that doesn't analyze the 32-bit build yet, right? > > > > We could do INT3s on 64-bit and NOPs on 32-bit. > > > > Or, possibly even better, we could just keep NOPs everywhere and instead > > make objtool smart enough to detect function fallthroughs. That should > > be pretty easy, actually. It already does it for C files. > > > > Something like the below should work, though it's still got a few > > issues: > > > > a) objtool is currently disabled for crypto code because it doesn't > > yet understand crypto stack re-alignments (which really needs > > fixing anyway); and > > > > b) it complains about the blank xen hypercalls falling through. Those > > aren't actual functions anyway, so we should probably annotate > > those somehow so that objtool ignores them anyway. > > > > I'm a bit swamped at the moment but I can fix those once I get a little > > more bandwidth. I at least verified that this patch caught the crypto > > missing RETs. > > Great, I'd be perfectly fine with such an approach. > > Also, if we have that then we could re-apply Alexey's patch and switch to INT3 > (only on 64-bit kernels) without any trouble, because objtool should detect any > execution flow bugs before the INT3 could trigger, right? > > I.e. any INT3 fault would show a combination of *both* an objtool bug and a > probable code flow bug - which I suspect would warrant crashing the box ... Sounds good to me. I can take Alexey's patch and submit a 64-bit version of it, along with the relevant objtool changes (though it may still be a few weeks before I get the chance). -- Josh