lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110620202504.GB17157@redhat.com>
Date:	Mon, 20 Jun 2011 22:25:04 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	torvalds@...ux-foundation.org, hch@...radead.org
Subject: Re: [PATCH 3/7] ptrace: move SIGTRAP on exec(2) logic to
	ptrace_event()

On 06/17, Tejun Heo wrote:
>
> Move SIGTRAP on exec(2) logic from tracehook_report_exec() to
> ptrace_event().  This is part of changes to make ptrace_event()
> smarter and handle ptrace event related details in one place.

I am going to apply all patches except 6/7, but to be honest this
one looks a bit ugly to me.

> -static inline int ptrace_event(int event, unsigned long message)
> +static inline void ptrace_event(int event, unsigned long message)
>  {
> -	if (likely(!ptrace_event_enabled(current, event)))
> -		return false;
> -	current->ptrace_message = message;
> -	ptrace_notify((event << 8) | SIGTRAP);
> -	return true;
> +	if (unlikely(ptrace_event_enabled(current, event))) {
> +		current->ptrace_message = message;
> +		ptrace_notify((event << 8) | SIGTRAP);
> +	} else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) {
> +		/* legacy EXEC report via SIGTRAP */
> +		send_sig(SIGTRAP, current, 0);
> +	}

Why does this make ptrace_event() smarter?

OK, tracehooks should die. But why should we move this special case
into ptrace_event? Say, a simple

	static inline void ptrace_exec_event(...)
	{
		if (!ptrace_event_enabled(PTRACE_EVENT_EXEC))
			send_sig(SIGTRAP, current, 0);
		else
			ptrace_event(PTRACE_EVENT_EXEC);
	}

in fs/exec.c looks a bit better to me.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ