Re: [tpmdd-devel] [PATCH] TPM: Let the tpm char device be openablemultiple times

From: Jason Gunthorpe
Date: Tue Nov 03 2009 - 17:42:17 EST


On Tue, Nov 03, 2009 at 01:14:28PM -0500, Valdis.Kletnieks@xxxxxx wrote:
> On Tue, 03 Nov 2009 09:31:55 PST, Hal Finney said:
> > What if you don't want it accessible by user mode apps, you only want
> > your middleware (ie tcs daemon, tcsd) to open it? Will this still
> > allow that to be enforced, so nobody can interfere with tcsd's
> > exclusive access to the device?
>
> Couldn't tcsd just open the device with O_EXCL? Or am I missing something
> subtle here?

O_EXCL isn't a locking flag...

O_EXCL Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and
pathname already exists, then open() will fail. The behavior of O_EXCL is undefined if O_CREAT is not
specified.

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