Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965680AbeAJPZZ (ORCPT + 1 other); Wed, 10 Jan 2018 10:25:25 -0500 Received: from resqmta-ch2-11v.sys.comcast.net ([69.252.207.43]:47342 "EHLO resqmta-ch2-11v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965117AbeAJPZX (ORCPT ); Wed, 10 Jan 2018 10:25:23 -0500 Date: Wed, 10 Jan 2018 09:25:20 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Kees Cook cc: linux-kernel@vger.kernel.org, Linus Torvalds , David Windsor , Alexander Viro , Andrew Morton , Andy Lutomirski , Christoph Hellwig , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christian Borntraeger , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH 02/36] usercopy: Include offset in overflow report In-Reply-To: <1515531365-37423-3-git-send-email-keescook@chromium.org> Message-ID: References: <1515531365-37423-1-git-send-email-keescook@chromium.org> <1515531365-37423-3-git-send-email-keescook@chromium.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfN5bu0juYjR4QHqxzrC+5fhzPxkpovn07tmYMpJu2wiBlDLO1x74klqSj1XFzSqR+TdxTodayLKOLQdaTRq1MzQlShtKFYm8PlaNSJ+Ag8doK8hoFN55 iCa6xnGOVJq2o7OvVVdf5qTL/U7ZIBTGUuNSK70epvWDNoiCEpoaw3cJldrAMuNc1CdVpkYKJCIZ05LT8c0OcS/BxSDZ5NIQpnoYCxilap9xyw8banYN1SXG OhznlCLCVwtd9yBvbZ656zHSi8yp1UYNcPhAMd6VYmsqSXgMaEfsNm51K9b5Mkb00kyjYRsULF3DQqpCA/jo60BQdvokh2DVd9ibbNJ+IwNL8fJXqVp67XMA 5W4K2RmVmqJXjH6JOCD1TfGcRW901tSmzr+ACeSyf/BJYnRaS/36xI43R2kT99eEeuWu/1BQBL/OePwqSxsB3KQ+AKuzTHFp+r3mqKyxsWkf3o9m1YLBpi2s AvIKHeO+O3umsAhmrY3MN1ZSQIIfKaJhFO3KTva33Pjod7NWzDBdWKijoviPLoZz8AkO1jn901yFj9LjwSEgaLBiNdvCH01wtBt8e5bC80j1gq/OuBW/nznL 2pC90Htana8Dt+ONc591RFXMt2lVDJLTh2mU3zN3p6P2n/aKlDr3iXDzF5oOC32cMUKVpWGeWYy4YvYjALi0FA5YWfxQ0J2/QF1/P5SEGHvLfsYXOliINAoG xwlVsYGAUiDH2W17sgtvTUXQPWjr2Z/ycSmhxiOHUhPKhjbUeNleHy7BiKuBbY5GWL1q8t/oJ9PHI4p7IShk4u9V0tsTbYf8iTccRETgLhw98KQb/992vELx e7zaNTyCDvMFQ5JsBlT/nTQ0FK9rdbXrev0fpr7EnXy1UUnySKSrMWE+qPrdkv25+mWQjjV4q2ShGwjebtQXgO3Hdt+Bn6tOc7HrPuro9bfLiFPgWKfZT6y1 GAH5nxQLeLZVt+/a5ezsp7DB1TzdCJSY0YOblE288I3AWiQh+JJcIbHOoaNckC1nZw1e3g== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, 9 Jan 2018, Kees Cook wrote: > -static void report_usercopy(unsigned long len, bool to_user, const char *type) > +int report_usercopy(const char *name, const char *detail, bool to_user, > + unsigned long offset, unsigned long len) > { > - pr_emerg("kernel memory %s attempt detected %s '%s' (%lu bytes)\n", > + pr_emerg("kernel memory %s attempt detected %s %s%s%s%s (offset %lu, size %lu)\n", > to_user ? "exposure" : "overwrite", > - to_user ? "from" : "to", type ? : "unknown", len); > + to_user ? "from" : "to", > + name ? : "unknown?!", > + detail ? " '" : "", detail ? : "", detail ? "'" : "", > + offset, len); > /* > * For greater effect, it would be nice to do do_group_exit(), > * but BUG() actually hooks all the lock-breaking and per-arch > * Oops code, so that is used here instead. > */ > BUG(); Should this be a WARN() or so? Or some configuration that changes BUG() behavior? Otherwise > + > + return -1; This return code will never be returned. Why a return code at all? Maybe I will see that in the following patches?