From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30841 invoked by alias); 13 Nov 2009 23:45:06 -0000 Received: (qmail 30811 invoked by uid 22791); 13 Nov 2009 23:45:03 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Nov 2009 23:44:57 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nADNitxM009076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Nov 2009 18:44:55 -0500 Received: from [10.16.2.46] (dhcp-100-2-46.bos.redhat.com [10.16.2.46]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nADNisST031978; Fri, 13 Nov 2009 18:44:54 -0500 Message-ID: <4AFDEF75.1080101@redhat.com> Date: Fri, 13 Nov 2009 23:45:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: Ingo Molnar CC: Andrew Morton , lkml , systemtap , DLE , Hidehiro Kawai , Oleg Nesterov , Roland McGrath Subject: Re: [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency References: <20091113225226.15079.90813.stgit@harusame> <20091113150904.56c15910.akpm@linux-foundation.org> <20091113232457.GC21666@elte.hu> In-Reply-To: <20091113232457.GC21666@elte.hu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00517.txt.bz2 Ingo Molnar wrote: > > * Andrew Morton wrote: > >> On Fri, 13 Nov 2009 17:52:27 -0500 >> Masami Hiramatsu wrote: >> >>> Pass mm->flags to binfmt core_dump for bitflag consistency. >>> Since mm->flags bit flags is not protected by locks, it will be >>> changed while dumping core. This patch copies mm->flags to a >>> mm_flags local variable at the beginning of do_coredump() and >>> use it while dumping. mm_flags also includes dump_filter which >>> filters elf sections from core file in elf_core_dump(). >>> So, this patch also passes mm_flags to each binfmt->core_dump(). >> >> I can kind-of guess the answer, but it would be much more reliable if >> we were to hear this from yourself: >> >> Why did you write this patch? What problem is being observed? > > i'm not Masami so i'm only guessing that while writing the tracepoint a > race got noticed but that otherwise there's no big practical effect, > 'just' a cleanliness problem fixed. Right, I'd like to add a tracepoint of coredump event with its information. And also, this patch may fix a small dumpable inconsistency issue below code --- 1787 if (mm->core_state || !get_dumpable(mm)) { <- (1) 1788 up_write(&mm->mmap_sem); 1789 put_cred(cred); 1790 goto fail; 1791 } 1792 [...] 1798 if (get_dumpable(mm) == 2) { /* Setuid core dump mode */ <-(2) 1799 flag = O_EXCL; /* Stop rewrite attacks */ 1800 cred->fsuid = 0; /* Dump root private */ 1801 } Since dumpable bits are not protected by lock, there is a chance to change these bits between (1) and (2). This patch copies mm->flags to a local variable and check the variable for consistency. Thank you, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com