Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4981474imb; Thu, 7 Mar 2019 05:15:37 -0800 (PST) X-Google-Smtp-Source: APXvYqz+bW+M3owwhUF81yXOpLnk1io5mJpD7gXepHpL8Knh5x2foLuKNM3kK9sMaJlG1lJOb5iL X-Received: by 2002:aa7:8012:: with SMTP id j18mr13221427pfi.42.1551964537019; Thu, 07 Mar 2019 05:15:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551964537; cv=none; d=google.com; s=arc-20160816; b=CesENXr7+SdkQi0jv1gBnec+3EM3NbzfjbryQL/5bsH3sPBNROHpuG1QCX4XqdEzJ0 JKjg4yQNBV7A1hpjqwVOSfDdEbqHz8fHthapljGjUJX3A7LhmQLohHAF6TitnM/OjSym bP7QAN6VA0m8X9bWzVGW+FNF5RohomiCZ+lhzapYlcc7Cv0HdQRRsO9FVsXXuXEu1IDn YwKiRvR2hgUNuEvzLSc5HvxZ7e3jCzR5HABAq/5f6X3JToqqyf++vvBDSTZBMhKmgvh2 bA6DywZIP6mtzgqOrY4/w9bEsNHwU7jS2IOvmV5uLtIws8Zxagd3L/vVaxNHLk+Lzqat Ur2A== 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:dkim-signature; bh=16T1xMsNBW8YtcgFDr1uWAjeTKs2Hka/m6a5mUMX8+c=; b=c+ilOiO5YE45ZPwnAiuMv6JAjnKT+8MuWckT9SVXsq2q842JSysrdI7/Tk7B5pYjU9 cMkQq0nBaAsgU31DnPcp1mn7TSeYuFVJFU1Sgw2PH/Z1pzncQ247Kes5FOXa9Q6NHdg/ /+JchX7sjuj6DDShnM9JWltSulojL1dho3RE+sGfz0hWBTRKJIARoMz6Uwbs3AyMOrDT mkIVk9IYAysN8W5/U1OlKlPYSKGPc95plPejqkhbaZjQ2+PPmpbj3PgKCvfy+Z5g7U0P WuGpQQEsTKdY2uIjdC17PkoLAswNginUuDRT6EWMg+HxY/mxZvaR5Kf7avqKOt0hHtwE frEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=YqebsCcp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si4127540plq.16.2019.03.07.05.15.20; Thu, 07 Mar 2019 05:15:36 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=YqebsCcp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726254AbfCGNNa (ORCPT + 99 others); Thu, 7 Mar 2019 08:13:30 -0500 Received: from merlin.infradead.org ([205.233.59.134]:51746 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfCGNNa (ORCPT ); Thu, 7 Mar 2019 08:13:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=16T1xMsNBW8YtcgFDr1uWAjeTKs2Hka/m6a5mUMX8+c=; b=YqebsCcpf4PzLM95vj0K8xVQJ FGoeQfDLeZyizmlQw3QLVIX6zNenUoWyMWYWHhuSKMW0uPV7is1Mr+6UjWA1dJjL3rltHR+OoTXHl DQxqJP0cqYw/2KxM+Qp+GB3jmMs1vhdNw301BrJLQzSuYvZkV2K1dTpGgVbyw/BMymBFLgy4T1viB U2AP0b+K6iFARDazH9YZuWxsQEPJ4LKdVY10P4ny0BT8kMig4xfGMovbS8hHbx3gtA11PwCkxYbzi oTcTzX875u0RRtpk+aimMmwOrAlvwvrjdPnrz6+9Si6ARd1DXHeTpmz2sHM8kycxZIc78YXuag8nP WnATs0urQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1spo-0005qy-2L; Thu, 07 Mar 2019 13:13:16 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 070E120297ED1; Thu, 7 Mar 2019 14:13:13 +0100 (CET) Date: Thu, 7 Mar 2019 14:13:12 +0100 From: Peter Zijlstra To: torvalds@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com, julien.thierry@arm.com, will.deacon@arm.com, luto@amacapital.net, mingo@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, valentin.schneider@arm.com, brgerst@gmail.com, jpoimboe@redhat.com, luto@kernel.org, bp@alien8.de, dvlasenk@redhat.com Cc: linux-kernel@vger.kernel.org, dvyukov@google.com, rostedt@goodmis.org Subject: Re: [PATCH 00/20] objtool: UACCESS validation v3 Message-ID: <20190307131312.GC32534@hirez.programming.kicks-ass.net> References: <20190307114511.870090179@infradead.org> <20190307120317.GD32477@hirez.programming.kicks-ass.net> <20190307125526.GB32534@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190307125526.GB32534@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote: > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote: > > 01be 20d3: 31 c0 xor %eax,%eax > > 01c0 20d5: 4c 39 eb cmp %r13,%rbx > > 01c3 20d8: 77 08 ja 20e2 <__do_sys_waitid+0x1cd> randconfig-build/kernel/exit.o: warning: objtool: __do_sys_waitid()+0x1c3: (branch) > > 01cd 20e2: 83 f0 01 xor $0x1,%eax > > 01d0 20e5: 48 89 c2 mov %rax,%rdx > > 01d3 20e8: 83 e2 01 and $0x1,%edx > > 01d6 20eb: 48 83 c2 02 add $0x2,%rdx > > 01da 20ef: 48 ff 04 d5 00 00 00 incq 0x0(,%rdx,8) > > 01e1 20f6: 00 > > 01de 20f3: R_X86_64_32S _ftrace_branch+0x148 > > 01e2 20f7: 84 c0 test %al,%al > > 01e4 20f9: 75 2d jne 2128 <__do_sys_waitid+0x213> > > we do not take this branch and fall-through. And that is the error, I think. We should've taken it and went to: return -EFAULT; because: +1be xor %eax,%eax eax=0 +1cd xor $0x1,%eax eax=1 +1e2 test %al,%al 1&1==1 -> ZF=0 +1e4 jnz Is an unconditional code sequence, but there's no way objtool can do that without becoming a full blown interpreter :/ > > 0213 2128: 49 c7 c7 f2 ff ff ff mov $0xfffffffffffffff2,%r15 > > ffffffffffffe0eb } > > 021a 212f: 48 8d 65 d8 lea -0x28(%rbp),%rsp > > 021e 2133: 4c 89 f8 mov %r15,%rax > > 0221 2136: 5b pop %rbx > > 0222 2137: 41 5c pop %r12 > > 0224 2139: 41 5d pop %r13 > > 0226 213b: 41 5e pop %r14 > > 0228 213d: 41 5f pop %r15 > > 022a 213f: 5d pop %rbp > > 022b 2140: c3 retq