From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756666Ab2GYMT6 (ORCPT ); Wed, 25 Jul 2012 08:19:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4364 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756555Ab2GYMT4 (ORCPT ); Wed, 25 Jul 2012 08:19:56 -0400 Date: Wed, 25 Jul 2012 14:16:44 +0200 From: Oleg Nesterov To: Djalal Harouni Cc: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Al Viro , Andrew Morton , Vasiliy Kulikov , WANG Cong , Solar Designer , Kees Cook , David Rientjes , Brad Spengler Subject: Re: [PATCH v2 2/2] proc: do not allow negative offsets on /proc//environ Message-ID: <20120725121644.GA6584@redhat.com> References: <1343143742-31229-1-git-send-email-tixxdz@opendz.org> <1343143742-31229-3-git-send-email-tixxdz@opendz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1343143742-31229-3-git-send-email-tixxdz@opendz.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/24, Djalal Harouni wrote: > > static int mem_open(struct inode *inode, struct file *file) > { > - return __mem_open(inode, file, PTRACE_MODE_ATTACH); > + int ret = __mem_open(inode, file, PTRACE_MODE_ATTACH); > + > + /* OK to pass negative loff_t, we can catch out-of-range */ > + file->f_mode |= FMODE_UNSIGNED_OFFSET; > + > + return ret; > } It could be even simpler, I meant file->f_mode |= FMODE_UNSIGNED_OFFSET; return __mem_open(inode, file, PTRACE_MODE_ATTACH); Never mind, this is very minor and the patch is already in -mm. Oleg.