Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8033180ybc; Fri, 29 Nov 2019 04:44:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyCEIL0s2hsbY7QEuv3AOMJZfkVPkyepvtFAf3a4NqHk5gEZEESc6Kft+db6RZrzjmWEm5i X-Received: by 2002:adf:ec48:: with SMTP id w8mr6384727wrn.19.1575031460303; Fri, 29 Nov 2019 04:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575031460; cv=none; d=google.com; s=arc-20160816; b=Ii6K1uovYvVpgNVpSnSAJbjkJJqgkBUk4GFaBsp4Kv3aCwpwLEaRRfkJ0XJ1DT1+pd P77/RISwgx2YpZNDw/0ENmWrBBjy/PKsd0HLzjoZP+WRm4kYi/j6oDL1hKLG5EG8JXtt zY/63yCWU0cvNgmDeIQQut18N9eKJWWQ4U6J0F1rfMaeUUe9xWWhk8UBxi/KBnGIKJ9e DpShtka3CFTGa1+XXe0JuIez6/Y1erRbWJ5QI4QXIsm6p7djLWnoRKHRfxSEx58xS63K fakJ/2qbx9phBP/IXXHqojbkRCOTWpoFWerA/WJJVrfdbKHLGwXif1Go9Opztb0fUuux D1ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=kjxlMI6YtDKB5gkwTnhmdBUMt8UGyGWoM27xK5f90nQ=; b=eSDvckDCPLhcyb1eLgXk1hS0DpED7pQoPpJ7DVwjww1hh/I4ByIfCeDSKw+344QQ77 KbRP14im3VeD4WeM2w17n+5gzunOypUBcbQVfMmn/y8F1+t7Ml0TALcuAG+5anunSFO3 +vvfcgw8fnXKs9Q4IcWDraLpQNIkfyDTa10NF5kfqHwTYUh7EJ70w05jEW8eef76uGlN /USDkZmKcwx2u3a5rdqgOcHdmmPs+LTcs8yTUO3CiTSYglWylH9Xqz7qLo7F0s0ve3k7 aYojV8xR6HfBllA4+r2GL2UmxHFmja7dfYlktOaSwUIjYMk/PLONW3MrPJ1Y7Zl1sy13 c7wA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n25si6697179wmd.57.2019.11.29.04.43.55; Fri, 29 Nov 2019 04:44:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726806AbfK2Mmp (ORCPT + 99 others); Fri, 29 Nov 2019 07:42:45 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64196 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726360AbfK2Mmp (ORCPT ); Fri, 29 Nov 2019 07:42:45 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xATCg4CV104204 for ; Fri, 29 Nov 2019 07:42:43 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2wjtts0c9f-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 29 Nov 2019 07:42:43 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Nov 2019 12:42:41 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 29 Nov 2019 12:42:37 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xATCgbCS66257032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Nov 2019 12:42:37 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFE9C11C058; Fri, 29 Nov 2019 12:42:36 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A79D011C04C; Fri, 29 Nov 2019 12:42:36 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 29 Nov 2019 12:42:36 +0000 (GMT) Received: from [9.81.207.37] (unknown [9.81.207.37]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 9B025A01F3; Fri, 29 Nov 2019 23:42:32 +1100 (AEDT) Subject: Re: [PATCH] relay: handle alloc_percpu returning NULL in relay_open To: Michael Ellerman , Daniel Axtens , linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk Cc: akash.goel@intel.com, syzbot+1e925b4b836afe85a1c6@syzkaller-ppc64.appspotmail.com, syzbot+587b2421926808309d21@syzkaller-ppc64.appspotmail.com, syzbot+58320b7171734bf79d26@syzkaller.appspotmail.com, syzbot+d6074fb08bdb2e010520@syzkaller.appspotmail.com References: <20191129013745.7168-1-dja@axtens.net> <87d0dbffbk.fsf@mpe.ellerman.id.au> From: Andrew Donnellan Date: Fri, 29 Nov 2019 23:42:33 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <87d0dbffbk.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19112912-4275-0000-0000-00000388029D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19112912-4276-0000-0000-0000389B97A2 Message-Id: <4415adee-5c12-3d65-d44a-34ee4eb00fed@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-29_03:2019-11-29,2019-11-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911290111 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/19 3:59 pm, Michael Ellerman wrote: >> diff --git a/kernel/relay.c b/kernel/relay.c >> index ade14fb7ce2e..a376cc6b54ec 100644 >> --- a/kernel/relay.c >> +++ b/kernel/relay.c >> @@ -580,7 +580,13 @@ struct rchan *relay_open(const char *base_filename, >> if (!chan) >> return NULL; >> >> - chan->buf = alloc_percpu(struct rchan_buf *); >> + chan->buf = alloc_percpu_gfp(struct rchan_buf *, >> + GFP_KERNEL | __GFP_NOWARN); >> + if (!chan->buf) { >> + kfree(chan); >> + return NULL; >> + } >> + >> chan->version = RELAYFS_CHANNEL_VERSION; >> chan->n_subbufs = n_subbufs; >> chan->subbuf_size = subbuf_size; > > This looks right to me. The kfree + direct return is correct, there's > nothing else that needs tear down in this function. > > I think I'm 50/50 on the __GFP_NOWARN. We're only asking for 8 bytes per > cpu, and if that fails the system is pretty sick, so a warning could be > helpful. There's also logic in the percpu allocator to limit the number > of warnings printed. But see what others think. mpe was wondering why we didn't see a message printed from the percpu allocator - the answer appears to be that we hit this case when the process is killed while the percpu allocator is waiting for pcpu_alloc_mutex, in which case it bails out without printing a warning. It looks to me like that case doesn't warrant a warning message, while a failing allocation for other reasons should probably get a warning. But whatever, otherwise this patch looks good to me. I've told our powerpc syzbot to test it. Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra ajd@linux.ibm.com IBM Australia Limited