Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4191124imm; Fri, 18 May 2018 00:29:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZorid5w6KlyStF1oP2+6HZGCzNPVMq/SsK/QyR8yE3tkI7gAPrHd0CH0ZsdnifOvIfBgpgL X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr8282073pli.137.1526628572595; Fri, 18 May 2018 00:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526628572; cv=none; d=google.com; s=arc-20160816; b=KWlOlpaawiXEMO7Tja5UUhGVnOMzxUid8DlK6VIBhHK/Z4A3IL1vjumGTGWkA2R17j YFKSeuExP7pmlrhspPDgva9zbMD7QMwHA5LEC1pKobPP8EQPk0WIPEVA5meCm99zVcuE yn9uKpwmKCSrpYptFp1NcYd6I/OzNntd7J8ORfNCcrZepyTJ0bbab46Esp7txjVAfiEB vFsIS7IPRqj1kkemUzf+BH12svyYGTUwLKWDPCMRiUCyjw/pqBr3jTxWPx4ctvNlBnay PBTzcVzuJgzbPEWUa4Rgl3z86i5AohSqBC47Ck2ytqlQjFxqWo3qyC9q/PGipcmtqBEj O8eg== 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:arc-authentication-results; bh=vz7ZZ4LurxLPB1sKQKFAh+vZh7Gt7VWgu1hjz9ZyfWM=; b=jSIAfT7ULD68TqIM98MpnwiXLbGPxgdEYxnCq3u2/DdMohjrPpqUmHpG/clGO9b/Su sEWdGcPRj1LBH2VYPE1l/+RVofmzIsi5q/FNhcR1/8u84jel2q4elCw+N7ET0pxWsgwI 9MTsV/ycPvX4npEkq8U43dkxePxFBUKyP6e44X+3JuUdiZQzcDdrQ8P+c+z4QW7ifnLD dw4Iv4GD0RjzoZn8kaWECoyEDvgSvbkjAPPKdTKWkS0IHczyzNrsZbuUaiU9EKsoB1Ix 8kkO2jVwX2CmIGQbUj0JKeSkvCHPDr88HDh8152hU+sH/fGpq8YEu3knL8jNdgbwZJTu Zmtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=H+CzZGcL; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12-v6si6964868plr.467.2018.05.18.00.29.17; Fri, 18 May 2018 00:29:32 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=H+CzZGcL; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752080AbeERH2F (ORCPT + 99 others); Fri, 18 May 2018 03:28:05 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39884 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbeERH2D (ORCPT ); Fri, 18 May 2018 03:28:03 -0400 Received: by mail-wr0-f193.google.com with SMTP id w18-v6so4327948wrn.6 for ; Fri, 18 May 2018 00:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vz7ZZ4LurxLPB1sKQKFAh+vZh7Gt7VWgu1hjz9ZyfWM=; b=H+CzZGcL1ox+4SgOw0M+4yjgMQRaUW5ZCfZsLmbGYj0HOW/U47XCO+Dr6j5hwbqByZ ulgWtBf6ReKPG4oHrVQzO9kV2yuveTeaR/OS/ulo7xbcZikAOfVJ3NhdxovRZdMU1j+e KqHL0eygylzid0SgZaJJjsIcktBGYGQ1tkcXqImP+Rx4589e6y69QYxR8Ca7xfx4d6Sg d56rfbc1JcLnR1506oiT2lssr3QUTV64oYhx4HvnhGADwCn2yAer/N86Rhv+Dbqs1ViD 7iCCsTNcEmijNPp7wEdBFy8AU+CcvatxacssEMU1Lry2+s9EtjB6Mo65/17b7bM5keGh ZCrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=vz7ZZ4LurxLPB1sKQKFAh+vZh7Gt7VWgu1hjz9ZyfWM=; b=EFIF30NTO3e5sSHBID/TWMgW8fgL6L14xjIQxeAQXFH5t01qINQnSBNApBJx1Dqxkq TsHb+u8R29TcFjTWz4//73l5LtV+a2q8eG6TIqn3S5r34T1D1qEhKUfrQQb0BxKI8h7r J+naN7Y3ilf/9EnbAqs8IWNtH7fR5sA7kAKwh0mp9FmOgJ+Xg5Fp2GF2pj5bOcYtJVQh 4Qgu4+60yJO6T7/1MoLwVK3eTq71lxp3iisPS61jengO26cHtKE49NpfIc57gny0hz1P Bn0ERDpqLHzo3uHe5UvFLcx7M5U0rlhyn4N16W6F37wSieuvaNAclPPecOoYTsiABV8X zyoA== X-Gm-Message-State: ALKqPwe0HlXM3qvJn0aw4pGZnRX6F+y1M1MKN/d/8ge+3YwAu7z4MXF/ 7NA6EXWU4JpR//DMP4dhSKU= X-Received: by 2002:adf:ab08:: with SMTP id q8-v6mr4781018wrc.239.1526628482901; Fri, 18 May 2018 00:28:02 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id m134-v6sm7719507wmg.4.2018.05.18.00.28.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 00:28:02 -0700 (PDT) Date: Fri, 18 May 2018 09:27:59 +0200 From: Ingo Molnar To: Josh Poimboeuf Cc: Linus Torvalds , Alexey Dobriyan , Peter Anvin , kernel test robot , Thomas Gleixner , Andrew Lutomirski , Borislav Petkov , Brian Gerst , Denys Vlasenko , Peter Zijlstra , Linux Kernel Mailing List , Peter Anvin , tipbuild@zytor.com, LKP Subject: Re: [PATCH] objtool: Detect assembly code falling through to INT3 padding Message-ID: <20180518072759.GA4326@gmail.com> References: <20180515214337.GA18021@avx2> <20180515222211.ods5hzne46hozojq@treble> <20180515224354.zmygmsnlqj5lrdbo@treble> <20180516033044.odb74pdgcn5nacwb@treble> <20180517134934.eog2fgoby5azq5a7@treble> <20180518071814.GB26358@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518071814.GB26358@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar wrote: > > * Josh Poimboeuf wrote: > > > With the following commit: > > > > 51bad67ffbce ("x86/asm: Pad assembly functions with INT3 instructions") > > > > ... asm function alignments are padded with INT3, so it's no longer safe > > to fall through to an aligned function. Make sure we catch any such > > cases with objtool. > > > > Note this only adds checking for 64-bit, since objtool doesn't support > > x86-32. > > > > Suggested-by: Thomas Gleixner > > Suggested-by: Linus Torvalds > > Signed-off-by: Josh Poimboeuf > > --- > > arch/x86/kernel/head_64.S | 2 -- > > tools/objtool/arch.h | 3 ++- > > tools/objtool/arch/x86/decode.c | 2 +- > > tools/objtool/check.c | 11 ++++++++++- > > 4 files changed, 13 insertions(+), 5 deletions(-) > > Ok, this is cool, it addresses the robustness problem that INT3 padding introduced > very nicely. > > The concept of built-in kernel tooling working at the machine code level is just > so powerful - we should have added our own KCC compiler 20 years ago. Hm, so a problem is that if we change the padding on 32-bit as well we won't have this detection there, because objtool doesn't work on 32-bit. Thanks, Ingo