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: <20151112005455.GA1651@swordfish>
Date:	Thu, 12 Nov 2015 09:54:55 +0900
From:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Christoph Lameter <cl@...ux.com>,
	Pekka Enberg <penberg@...nel.org>,
	Joonsoo Kim <iamjoonsoo.kim@....com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Subject: Re: [PATCH 2/3] tools/vm/page-types: suppress gcc warnings

On (11/11/15 12:44), David Rientjes wrote:
[..]
> This can't possibly be correct, the warnings are legitimate and the result
> of the sigsetjmp() in the function.  You may be interested in
> returns_twice rather than marking random automatic variables as volatile.

Hm, ok. I saw no probs with `int first' and `end' being volatile

static void walk_file(const char *name, const struct stat *st)
{
	int first = 1;

	for (...) {

		if (sigsetjmp(sigbus_jmp, 1)) {
			goto got_sigbus;
		}

got_sigbus:
		...
		if (first && opt_list) {
			first = 0;
			print_foo();
		}
	}
}


the `end' is also looked fine.


ANSI C

ยง7.13.2.1

3 All accessible objects have values, and all other components of the abstract machine 249)
  have state, as of the time the longjmp function was called, except that the values of
  objects of automatic storage duration that are local to the function containing the
  invocation of the corresponding setjmp macro that do not have volatile-qualified type
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  and have been changed between the setjmp invocation and longjmp call are indeterminate.


Thus, adding 'volatile' should do the trick. Isn't it?
I need to google more - is returns_twice actually prevents gcc from
`over-optimizing' (there are some bug reports that state that setjmp can
be screwed up by gcc) or it's actually because the programs that do setjmp
basically violate ANSI C standard and don't volatile-qualify the affected
variables. Any hint would be helpful.

	-ss
--
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