From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB4D8C433DF for ; Tue, 18 Aug 2020 13:40:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8B84D206B5 for ; Tue, 18 Aug 2020 13:40:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ijhyYXds" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B84D206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 104286B0024; Tue, 18 Aug 2020 09:40:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B46B6B0026; Tue, 18 Aug 2020 09:40:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0CEB8D0001; Tue, 18 Aug 2020 09:40:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id DA8936B0024 for ; Tue, 18 Aug 2020 09:40:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 96159824556B for ; Tue, 18 Aug 2020 13:40:55 +0000 (UTC) X-FDA: 77163800070.03.jail80_200034a2701f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id DEB4B28A4E9 for ; Tue, 18 Aug 2020 13:40:40 +0000 (UTC) X-HE-Tag: jail80_200034a2701f X-Filterd-Recvd-Size: 2759 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Aug 2020 13:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597758039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LXWmYAEPDvHrYOWUrEhJYqbCxad+Oxs8vtQSuseqfi8=; b=ijhyYXdsMM68jN67iflaxz7KkkRZHPw+5fux5on9LQYcBYK2Lj3/9WjxwbtYhOVfltTnwo rYWs7+StJVgtTEBYPsOHlKe621Nu/ENOk7F50JSB5RKkI0I2x1vxhg0Fcj0t5psPP4yHo+ 1lSHGpdIQwnysh81aelyIMCgD3VnCUQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-318-VyxC6xixMB26SP9NZten_g-1; Tue, 18 Aug 2020 09:40:35 -0400 X-MC-Unique: VyxC6xixMB26SP9NZten_g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3EF21006701; Tue, 18 Aug 2020 13:40:33 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.59]) by smtp.corp.redhat.com (Postfix) with SMTP id E20C65C1DC; Tue, 18 Aug 2020 13:40:29 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 18 Aug 2020 15:40:33 +0200 (CEST) Date: Tue, 18 Aug 2020 15:40:28 +0200 From: Oleg Nesterov To: Jann Horn Cc: Andrew Morton , Linus Torvalds , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Alexander Viro , "Eric W . Biederman" Subject: Re: [PATCH v3 2/5] coredump: Let dump_emit() bail out on short writes Message-ID: <20200818134027.GF29865@redhat.com> References: <20200818061239.29091-1-jannh@google.com> <20200818061239.29091-3-jannh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200818061239.29091-3-jannh@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Rspamd-Queue-Id: DEB4B28A4E9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/18, Jann Horn wrote: > > + if (dump_interrupted()) > + return 0; > + n = __kernel_write(file, addr, nr, &pos); > + if (n != nr) > + return 0; > + file->f_pos = pos; Just curious, can't we simply do __kernel_write(file, addr, nr, &file->f_pos); and avoid "loff_t pos" ? Oleg.