From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422917AbcEaCQk (ORCPT ); Mon, 30 May 2016 22:16:40 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42239 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1162202AbcEaCQh (ORCPT ); Mon, 30 May 2016 22:16:37 -0400 Message-Id: <201605310216.u4V2DXns044960@mx0a-001b2d01.pphosted.com> X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: zohar@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-security-module@vger.kernel.org;linux-unionfs@vger.kernel.org Subject: Re: [PATCH v3 1/1] ovl: setxattr: don't deadlock when called from ima_fix_xattr. From: Mimi Zohar To: Al Viro Cc: Miklos Szeredi , Krisztian Litkey , linux-unionfs@vger.kernel.org, Krisztian Litkey , linux-security-module , linux-kernel@vger.kernel.org Date: Mon, 30 May 2016 22:15:31 -0400 In-Reply-To: <20160530165007.GA14480@ZenIV.linux.org.uk> References: <1463611500.2465.22.camel@linux.vnet.ibm.com> <1463725718-2461-1-git-send-email-kli@iki.fi> <1463754087.2763.17.camel@linux.vnet.ibm.com> <20160520162937.GU14480@ZenIV.linux.org.uk> <1463763633.2763.34.camel@linux.vnet.ibm.com> <20160530141015.GC5758@veci.piliscsaba.szeredi.hu> <20160530165007.GA14480@ZenIV.linux.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16053102-0016-0000-0000-0000019FECDF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16053102-0017-0000-0000-000004BBA72F X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-05-31_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=33 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1605310024 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-05-30 at 17:50 +0100, Al Viro wrote: > Only tangentially related, but... that bug had been discussed, > without any results: the fallback in ima_d_path() to ->d_name.name is > completely broken. There is no warranty whatsoever that dentry won't be > renamed, with its earlier (too long to be embedded into dentry itself) > ->d_name.name getting freed. Right under your code. Isn't i_mutex required? > > Could we please get rid of that thing? "A message in a near-oom > situation might be less informative than we'd like" is better than > "this code might end up dereferencing freed memory". > > Another similar bug is in ima_collect_measurement() - > const char *filename = file->f_path.dentry->d_name.name; > ... > integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode, > filename, "collect_data", audit_cause, > with no warranty whatsoever that you are not passing a pointer to freed > memory. The same goes for ima_eventname_init_common() - > if (event_data->file) { > cur_filename = event_data->file->f_path.dentry->d_name.name; > cur_filename_len = strlen(cur_filename); > } else > ... > return ima_write_template_field_data(cur_filename, cur_filename_len, > DATA_FMT_STRING, field_data); > -- > To unsubscribe from this list: send the line "unsubscribe linux-security-module" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >