Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752940AbbBWSuL (ORCPT ); Mon, 23 Feb 2015 13:50:11 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:58457 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752284AbbBWSuI (ORCPT ); Mon, 23 Feb 2015 13:50:08 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Dan Carpenter Cc: Andrew Morton , Andy Lutomirski , Wang YanQing , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20150223154419.GA2542@mwanda> <87385w1rmd.fsf@x220.int.ebiederm.org> <20150223180326.GC5116@mwanda> Date: Mon, 23 Feb 2015 12:46:37 -0600 In-Reply-To: <20150223180326.GC5116@mwanda> (Dan Carpenter's message of "Mon, 23 Feb 2015 21:03:27 +0300") Message-ID: <87fv9wzcs2.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX193fwVjKayFmQu/yYueaGv4CGRJIl7PkFI= X-SA-Exim-Connect-IP: 70.59.163.10 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4996] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Dan Carpenter X-Spam-Relay-Country: X-Spam-Timing: total 3916 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.5 (0.1%), b_tie_ro: 2.5 (0.1%), parse: 0.65 (0.0%), extract_message_metadata: 11 (0.3%), get_uri_detail_list: 1.13 (0.0%), tests_pri_-1000: 3.2 (0.1%), tests_pri_-950: 1.27 (0.0%), tests_pri_-900: 1.04 (0.0%), tests_pri_-400: 17 (0.4%), check_bayes: 16 (0.4%), b_tokenize: 4.6 (0.1%), b_tok_get_all: 6 (0.1%), b_comp_prob: 1.77 (0.0%), b_tok_touch_all: 2.3 (0.1%), b_finish: 0.56 (0.0%), tests_pri_0: 151 (3.9%), tests_pri_500: 3724 (95.1%), poll_dns_idle: 3704 (94.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [patch] groups: integer underflow in groups_alloc() X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1764 Lines: 42 Dan Carpenter writes: > On Mon, Feb 23, 2015 at 11:10:02AM -0600, Eric W. Biederman wrote: >> Dan Carpenter writes: >> >> > This is called from rsc_parse() with a use controlled value. Say for >> > example that "gidsetsize" is negative, then we could end up allocating >> > less than sizeof(struct group_info) leading to memory corruption. >> >> Right now it is the responsibility of the caller of groups_alloc to make >> certain that gidsetsize is a valid value, and the callers of >> groups_alloc who know what they are doing already validate this value. >> >> Either the pattern of caller validates the messages needs to continue, >> or groups_alloc needs to be changed and all of the callers need to be >> updated. >> >> Changing groups_alloc for one particular caller is just going to cause >> maintenance problems. >> > > This only affects NFS so let's hear from them if this limit is correct > and decide from there. The bug may be nfs specific bug changing groups_alloc does not only affect nfs. NGROUPS_MAX is the maxmimum number of groups the linux kernel supports so NGROUPS_MAX may be high but it is certainly not wrong. Your patch takes the wrong approach, creates code that is an inconsistent mess and is thus wrong. As setgroups is code that is called every day I don't think only paying attention to NFS when talking how to change this is in any way appropriate, unless you propose an NFS specific fix (which you clearly did not). Eric -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/