Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp493029pxj; Thu, 3 Jun 2021 11:39:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Z5wZgT6eKDlj2D97/M9hAUKdyTjDCcZ0FzMUouceI3Xk6oyX3qHBGWBaD5zUgKjcs/GC X-Received: by 2002:a17:906:4d56:: with SMTP id b22mr669391ejv.78.1622745558227; Thu, 03 Jun 2021 11:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622745558; cv=none; d=google.com; s=arc-20160816; b=TpVEdneGGtq684mr0fHVstTRi3HUPYWZLSOUZ9BJY9nP8q3pY711//Ul8CEre079WB Kc0OQIFAc1Si+sfVz0eehaOJVVFRhqHL3VrCsKynTPsH2XjtfO1cL/mBCpCZQ3H1IIpu 7fqo0HvhsFdy5EIkRocatm8120Vrp95KLseDaFT4RIS9dvo/gj8jww50sSZRyzHJQbMG bB1C6pwVkydTzBSV18BtdIxsX89OXe017lshXEZBzoViu+L0Q2Mki1st41f4hXFxTPvV 1+4n+DUNHEHo9fq2SNPse5L8y8ey/+IktEZXvNxhMiFQXscHSc7PEGerqNwRtTLLPj3Z 2S3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BEr//xjV1GqZSBzi3bsF+G1FWwbefcv6uCbPmM9RANQ=; b=fViteFxqiSdfwbjQvpJWn0QRVNYy+gj6ltbDNPhz9vi4Ag2txeyUKbY4BTc7bBwG9/ qnIZ9fZT536tlIexeFbq2cZRqpCu/99k4Z2HkHzS4fN8h5i993ILMBwgBAo3klKkF9uP wD/qLB1SsCD0IpjjdHjUhAFx1kX4gtOtxneTDexT7JKvCOYleLkINoYbiYr43x2LpXy2 px0NsuIN7ubakcoPwlpe1A2p5p4J6Qap1vYHarpUqRsZ5HLWi8uTkNUMKM2nXRMJIpYO qMAQhCVcy/LLKjyquIYapHgubPx9EzMn3JpO8OUF6NcL9KNHl+lKQlr9OaUxxsXOQoRI d0fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=pplRkp7E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si2895942eds.77.2021.06.03.11.38.54; Thu, 03 Jun 2021 11:39:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=pplRkp7E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbhFCSjD (ORCPT + 99 others); Thu, 3 Jun 2021 14:39:03 -0400 Received: from mail.skyhub.de ([5.9.137.197]:45128 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFCSjB (ORCPT ); Thu, 3 Jun 2021 14:39:01 -0400 Received: from zn.tnic (p200300ec2f13850043af4c4d530a3258.dip0.t-ipconnect.de [IPv6:2003:ec:2f13:8500:43af:4c4d:530a:3258]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 087CE1EC04A6; Thu, 3 Jun 2021 20:37:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1622745436; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=BEr//xjV1GqZSBzi3bsF+G1FWwbefcv6uCbPmM9RANQ=; b=pplRkp7EY+j9InipnsnnnKO/1sbfKryAA3g8xS3VlD8O/OBPlMooUIp264da5HsrdXfEyh ltmTCqJ4TnzY3bzBjOC2Vzg0boeUt9epLGfJEsCOTdb8MtiZn+XtCNwroE/9Kv016b6Rtt XrduIsQT/Endddr+FRp8lWaSbL82QkI= Date: Thu, 3 Jun 2021 20:37:11 +0200 From: Borislav Petkov To: Jiashuo Liang Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , "Eric W. Biederman" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] signal/x86: Don't send SIGSEGV twice on SEGV_PKUERR Message-ID: References: <20210601085203.40214-1-liangjs@pku.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210601085203.40214-1-liangjs@pku.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 01, 2021 at 04:52:03PM +0800, Jiashuo Liang wrote: > Before this patch, the __bad_area_nosemaphore function calls both > force_sig_pkuerr and force_sig_fault when handling SEGV_PKUERR. This does > not cause problems because the second signal is filtered by the > legacy_queue check in __send_signal. I'm likely missing something but the first signal gets filtered by that same legacy_queue() check too, no? Because both calls end up in force_sig_info_to_task(info, current); with the info struct populated with: info.si_signo = SIGSEGV; info.si_errno = 0; info.si_code = SEGV_PKUERR; info.si_addr = addr; info.si_pkey = pkey; except the second call - force_sig_fault() - doesn't put pkey in ->si_pkey. So what's up? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette