Received: by 10.223.176.46 with SMTP id f43csp1150100wra; Wed, 24 Jan 2018 11:27:24 -0800 (PST) X-Google-Smtp-Source: AH8x2245t6EtwYG3i2stW7oIVdJKNypC/qwvMaKbuGlCELxbZjY2e6lYnxXTieRH6Fmh36lEjFCl X-Received: by 2002:a17:902:780d:: with SMTP id p13-v6mr3138052pll.296.1516822043944; Wed, 24 Jan 2018 11:27:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516822043; cv=none; d=google.com; s=arc-20160816; b=fZrWRPmrHyqXX3uVm0rrcffF2v1AzKFX3iJchIaBKtLKQTLUs9YriRCeyvQ77+vXTk RsRFMdPDcUng5N+zHTRClt56N2HZRKfichXINd/RKypWVaftjfOlMC1tkN0iS3KFEpYF FrRhxRwyl514BQ/CNXe/CBvoAj5xK1eoGMFBTOPwZ77k9FKYM/3XNzzT+Rv8VW8WfEss dNXmIxDxzWpmnhltwClHBEgKGlUaFO13ZCsM0Y9Mk14sVTRcsPjrJRGGIktkEOEa2Djq pwUomPW1hUvRrO0DpWne6VIHe2zataQq/C2RTjdoawzxVg9W8sx0IpmYTUNQw6di9uDI G3hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=wbnugfivyVWDsK9v8bWECnD9TLxRmgvI3mDONxuY7H8=; b=XRFgCOS8RDC4Nv4sVd7Q14+YFZF1kGW3th7hKaygwC+xuIYizgh8jRDtl+onbyncJC xcdlhbUH+ihrusYQqIiUNfex3iBRm8HTp9yic3S5rsFnczoFwtmlGpJFXKquj1GH0Vay qTYKdTf6g0vss6/upgr0GZaMdwxQKQPmLNdKr7KDd1A8uojQ6NVG6U4VzEg1vjdedDMv bTzCpSENnR+GJA6mZdrnyl2uwValaY2/IjBjpZKspl4wWDR+IowaGe8TxvS4ZwIyJGVh ZHzAMxFtAV9PEQvEbYJyvoFC6H+5pUZ4UV+OlYct81Pub8N59Js9iYMgTBRppOlNN0PY j8/g== 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 a11-v6si637586pln.694.2018.01.24.11.27.09; Wed, 24 Jan 2018 11:27:23 -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 S932153AbeAXT0o (ORCPT + 99 others); Wed, 24 Jan 2018 14:26:44 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41702 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752450AbeAXT0n (ORCPT ); Wed, 24 Jan 2018 14:26:43 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0OJNplM043175 for ; Wed, 24 Jan 2018 14:26:43 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fpyawj6xh-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 24 Jan 2018 14:26:42 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Jan 2018 19:26:40 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 24 Jan 2018 19:26:37 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0OJQbcR37290140; Wed, 24 Jan 2018 19:26:37 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D04A1A4051; Wed, 24 Jan 2018 19:20:15 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB747A404D; Wed, 24 Jan 2018 19:20:14 +0000 (GMT) Received: from ram.oc3035372033.ibm.com (unknown [9.85.191.212]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 24 Jan 2018 19:20:14 +0000 (GMT) Date: Wed, 24 Jan 2018 11:26:32 -0800 From: Ram Pai To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, Al Viro , Oleg Nesterov , linux-arch@vger.kernel.org Subject: Re: [PATCH 06/10] signal: Helpers for faults with specialized siginfo layouts Reply-To: Ram Pai References: <87607s5lra.fsf_-_@xmission.com> <20180123210719.10456-6-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180123210719.10456-6-ebiederm@xmission.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 18012419-0008-0000-0000-000004C57333 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18012419-0009-0000-0000-00001E58F7F6 Message-Id: <20180124192632.GA6671@ram.oc3035372033.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-24_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801240256 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 23, 2018 at 03:07:15PM -0600, Eric W. Biederman wrote: > The helpers added are: > send_sig_mceerr > force_sig_mceerr > force_sig_bnderr > force_sig_pkuerr > > Filling out siginfo properly can ge tricky. Especially for these > specialized cases where the temptation is to share code with other > cases which use a different subset of siginfo fields. Unfortunately > that code sharing frequently results in bugs with the wrong siginfo > fields filled in, and makes it harder to verify that the siginfo > structure was properly initialized. > > Provide these helpers instead that get all of the details right, and > guarantee that siginfo is properly initialized. > > send_sig_mceerr and force_sig_mceer are a little special as two si > codes BUS_MCEERR_AO and BUS_MCEER_AR both use the same extended > signinfo layout. nice. i can make use of these helpers in the memory-key implementation. One small nit-pick below though... > > Signed-off-by: "Eric W. Biederman" > --- > include/linux/sched/signal.h | 6 +++++ > kernel/signal.c | 61 ++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 67 insertions(+) > > diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h ...snip.. > + > +#ifdef SEGV_PKUERR Should this really be under SEGV_PKUERR ? that macro is defined unconditionally anyway. > +int force_sig_pkuerr(void __user *addr, u32 pkey) > +{ > + struct siginfo info; > + > + clear_siginfo(&info); > + info.si_signo = SIGSEGV; > + info.si_errno = 0; > + info.si_code = SEGV_PKUERR; > + info.si_addr = addr; > + info.si_pkey = pkey; > + return force_sig_info(info.si_signo, &info, current); > +} > +#endif