Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbdLKSlD (ORCPT ); Mon, 11 Dec 2017 13:41:03 -0500 Received: from mail-ot0-f178.google.com ([74.125.82.178]:36481 "EHLO mail-ot0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbdLKSk6 (ORCPT ); Mon, 11 Dec 2017 13:40:58 -0500 X-Google-Smtp-Source: ACJfBou608cb3dk4lLXZ/O5UK4tPknLTlpsOYt2Y0q/rw2xudmcnyWpKdtqr1Xf6aGKOpC4+f0m77A== Subject: Re: [PATCH] doc: convert printk-formats.txt to rst To: "Tobin C. Harding" , Joe Perches Cc: Dan Carpenter , Kees Cook , Jonathan Corbet , Randy Dunlap , Andrew Murray , linux-doc@vger.kernel.org, LKML References: <1512524729-16051-1-git-send-email-me@tobin.cc> <20171207234402.GT2191@eros> <20171208004627.GW2191@eros> <1512768157.1845.30.camel@perches.com> <20171209012736.GC2191@eros> <1512785925.26342.4.camel@perches.com> <20171209063335.GD2191@eros> From: Laura Abbott Message-ID: <6ccb79e1-bf1b-0862-ec79-2f3f7763db62@redhat.com> Date: Mon, 11 Dec 2017 10:40:54 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171209063335.GD2191@eros> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2304 Lines: 62 On 12/08/2017 10:33 PM, Tobin C. Harding wrote: > [Adding Laura] > > On Fri, Dec 08, 2017 at 06:18:45PM -0800, Joe Perches wrote: >> On Sat, 2017-12-09 at 12:27 +1100, Tobin C. Harding wrote: >>> On Fri, Dec 08, 2017 at 01:22:37PM -0800, Joe Perches wrote: >> >>>> Outside of the documentation, what could be useful is for >>>> someone to add a tool to verify %p extension to >>>> the typeof address actually passed as an argument. >>> >>> This sounds interesting to work no. At first glance I have no idea how >>> one would go about this. Some form of static analysis would be a good >>> place to start, right? I'd like to allocate some cycles to this, any >>> pointers most appreciated. >> >> A gcc-plugin would likely work best. > > What's the learning curve like in your opinion to do a gcc-plugin. I > recall reading someplace 'deep understanding of how the compiler works' > or some such thing. I suppose reading the Dragon book would be a good > place to start? > The hardest part of doing a gcc-plugin is understanding the gccisms. There isn't much documentation and most of what there is ends up being "here's how you hook into the compiler at point X" without showing how you do anything with it. The Dragon book (also known as "Compilers: Principles, Techniques, and Tools" for those who haven't heard of it before) is a great resource for general compiler concepts but it's not helpful for gcc-specific work. Writing about some of my experiments on my gcc-plugins has been on my TODO list for a while. 2018 resolution on actually finishing it perhaps. > We could also catch pointers being cast to longs and printed with %x > (and %u) or so I would guess. > >> There was some discussion about such a thing here: >> http://www.openwall.com/lists/kernel-hardening/2017/02/14/38 > > Did you make much progress with this Laura? > Not particularly. I wanted to re-use the kernel's print functionality in the plugin to automatically check new formats but I went down a rathole trying to make it work and got side tracked with other things and never picked it up again. >> I vaguely recall someone else doing a broader use tool >> which I believe was not smatch, but my google-fu isn't >> finding it. >> >> It might have been coccinelle based. > > thanks, > Tobin. > Thanks, Laura