Received: by 10.223.176.46 with SMTP id f43csp1234199wra; Wed, 24 Jan 2018 12:56:51 -0800 (PST) X-Google-Smtp-Source: AH8x2257zZ2IkyA552+GG31TtohNTJStDNnqx0BoYX0CpdgAEgL7SH4BZd+Ug9n8UdLzU388n0k0 X-Received: by 2002:a17:902:7d09:: with SMTP id z9-v6mr5374422pll.427.1516827411439; Wed, 24 Jan 2018 12:56:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516827411; cv=none; d=google.com; s=arc-20160816; b=vPkXbvAfwr/CijCv4rCPPg07ZRNDzLUI4pUCJ+HUY4w1sDYI3rV0N80BTn7vF8qUTu GaE/yq/fT02NQAn8C/qfOnsiqU+9wcLpfK/8ShQOV7iwNMkhkZOBm7uaggMUNhElJBhk nKwA1+xy6Z4n7refLWS+dI+55U0fdTWBKl4bid693H63E4pkowYAgGr6E5uOU9qhr+94 ikY4zaOhfDS00N0a8qijMjgkcAp3s2Fa3tJJy4tccecP8nV1NEgvu0w7YnnTtGK9ekDI I5UEmtiEebTAZOjpbDdWL+rG/MAjCputKNyoOLS+rJmmC1prYZwroMY8Y4+rj8f3CWnS s1cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=dYLTrphM/cjPMHifzDXFEG+pDfebVCOwqRBehb6ULIo=; b=TmbO1Vaghi46BZC6ZhAkArd3aCqHWKen3V8vk+lyWhZ9e6iDzsHMSIAH10k5ceG9// LxuXpYm+woTd9niVQDBbcsfTCGaXoXg8M5I3b3oYGuMzCgBFSUGER2lyiF+gDB2MHRQ3 hpZh683km2wu5XYsgnFOqSWeFZfJhLA2e4xzT8PnMwbhH0HXuMuHHE9dgL3XiLvntZ07 jPpGY3AtW21EmCFQT3ipqqowUbyqsH5AiW88QHxbro+8dUvlOKuJFXAwwwIxIWsc+YGs pfjwVpjCpG/o6qoPYdDcXrC6Kdid34NoltRTlZPGP1zlwrxaMZRa8o6Q5MdpX9H3S4d4 kTsQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si565167pgr.349.2018.01.24.12.56.37; Wed, 24 Jan 2018 12:56:51 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932818AbeAXUzJ (ORCPT + 99 others); Wed, 24 Jan 2018 15:55:09 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:43979 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932507AbeAXUzG (ORCPT ); Wed, 24 Jan 2018 15:55:06 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eeS4X-0001BR-Ei; Wed, 24 Jan 2018 13:55:05 -0700 Received: from 97-121-88-104.omah.qwest.net ([97.121.88.104] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eeS4W-0008D7-MQ; Wed, 24 Jan 2018 13:55:05 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Ram Pai Cc: linux-kernel@vger.kernel.org, Al Viro , Oleg Nesterov , linux-arch@vger.kernel.org References: <87607s5lra.fsf_-_@xmission.com> <20180123210719.10456-6-ebiederm@xmission.com> <20180124192632.GA6671@ram.oc3035372033.ibm.com> Date: Wed, 24 Jan 2018 14:54:06 -0600 In-Reply-To: <20180124192632.GA6671@ram.oc3035372033.ibm.com> (Ram Pai's message of "Wed, 24 Jan 2018 11:26:32 -0800") Message-ID: <87zi53x9jl.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1eeS4W-0008D7-MQ;;;mid=<87zi53x9jl.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.121.88.104;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+Eamai+Kdmu4IOseemXaB7ByJ9zraPhOc= X-SA-Exim-Connect-IP: 97.121.88.104 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4522] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Ram Pai X-Spam-Relay-Country: X-Spam-Timing: total 230 ms - load_scoreonly_sql: 0.11 (0.0%), signal_user_changed: 3.4 (1.5%), b_tie_ro: 2.3 (1.0%), parse: 1.33 (0.6%), extract_message_metadata: 13 (5.6%), get_uri_detail_list: 2.3 (1.0%), tests_pri_-1000: 6 (2.6%), tests_pri_-950: 1.30 (0.6%), tests_pri_-900: 1.06 (0.5%), tests_pri_-400: 22 (9.7%), check_bayes: 21 (9.3%), b_tokenize: 7 (2.9%), b_tok_get_all: 7 (3.2%), b_comp_prob: 2.4 (1.1%), b_tok_touch_all: 3.0 (1.3%), b_finish: 0.59 (0.3%), tests_pri_0: 173 (75.2%), check_dkim_signature: 0.60 (0.3%), check_dkim_adsp: 2.6 (1.1%), tests_pri_500: 5.0 (2.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 06/10] signal: Helpers for faults with specialized siginfo layouts X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ram Pai writes: > 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. Unless you are running my unified siginfo.h (from an earlier patchset which I build upon). It turns out that ia64 has a conflict for that number. So ia64 really can't use the define and this infrastructure. We might decide to sort that out and always have SEGV_PKUERR always defined. Sadly for the moment the #ifdef is necessary. >> +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 Eric