From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422960AbdEXVme (ORCPT ); Wed, 24 May 2017 17:42:34 -0400 Received: from imap.thunk.org ([74.207.234.97]:34816 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033670AbdEXVmb (ORCPT ); Wed, 24 May 2017 17:42:31 -0400 Date: Wed, 24 May 2017 17:42:28 -0400 From: "Theodore Ts'o" To: Michael Schmitz Cc: linux-kernel@vger.kernel.org, linux-m68k@vger.kernel.org Subject: Re: [RFC] fix race in drivers/char/random.c:get_reg() Message-ID: <20170524214228.u5xysvdalferoxw5@thunk.org> Mail-Followup-To: Theodore Ts'o , Michael Schmitz , linux-kernel@vger.kernel.org, linux-m68k@vger.kernel.org References: <1493538561-5075-1-git-send-email-schmitzmic@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1493538561-5075-1-git-send-email-schmitzmic@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 30, 2017 at 07:49:21PM +1200, Michael Schmitz wrote: > get_reg() can be reentered on architectures with prioritized interrupts > (m68k in this case), causing f->reg_index to be incremented after the > range check. Out of bounds memory access past the pt_regs struct results. > This will go mostly undetected unless access is beyond end of memory. > > Prevent the race by disabling interrupts in get_reg(). > > Tested on m68k (Atari Falcon, and ARAnyM emulator). > > Kudos to Geert Uytterhoeven for helping to trace this race. > > Signed-off-by: Michael Schmitz Thanks, applied. It will go to Linus shortly. - Ted