Re: [Haskell-cafe] Enhancing the security of hackage

2010-12-09 Thread Lally Singh
On Thu, Dec 9, 2010 at 7:04 AM, Ketil Malde  wrote:
> Vincent Hanquez  writes:
>
>> You might have misunderstood what I was talking about. I'm proposing
>> signing on the hackage server on reception of the package,
>
> Okay, fair enough.  You can't *enforce* this, of course, since I might
> work without general internet access but a local mirror, but you could
> require me to run 'cabal --dont-check-signatures' or similar, so this
> would still make a hostile-operated mirror less useful.
>
> OTOH, if I should suggest improving the security of Hackage, I would
> prioritize:
>
> a) email the maintainer whenever a new upload is accepted - preferably
>   with a notice about whether the build works or fails.  Mabye also
>   highlight the case when maintainer differs from uploader - if that
>   doesn't give a ton of false positives.
>
> b) email the *previous* maintainer when a new upload is accepted and the
>   maintainer field has changed.
>
> This way, somebody is likely to actually *notice* when some evil person
> uploads a trojan mtl or bytestring or whatever.  The downside is more
> mail, and the people who run Hackage have been wary about this.  So
> perhaps even this is on the wrong side of the cost/benefit fence.
>
> (People with admin privileges (staff or hackers) to hackage can of course
>  still work around everything - crypto signatures or email-schemes.)
>
> -k

Also, perhaps put the signatures on a separate machine from the one
containing .tar.gz.  For a 3rd party to corrupt a package, they'd need
to hack 2 machines.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] LLVM, type-level?

2010-12-08 Thread Lally Singh
On Tue, Dec 7, 2010 at 1:31 PM, Henning Thielemann
 wrote:
>
> On Tue, 7 Dec 2010, Lally Singh wrote:
>
>> Hey all,
>>
>>  I'm generating a structure definition from input, and would like to
>> generate some LLVM code that can use it.  I see an 'alloca' function
>> in LLVM.Core that may do the trick, but takes a static type (Ptr a),
>> which I wouldn't have.  Is there a dynamic variant?  I'm currently
>> generating a TypeDesc Struct type.
>
>  How much flexibility do you need? Is the user really allowed to specify an
> arbitrary 'struct' declaration? This could be a security hole.
>  If you really want it, I think you would have to use existential
> quantification in order to construct a user defined type at runtime.

Could you elaborate on this a bit more?  Or is there an example
somewhere I could look at?

Thanks,
-Lally

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] LLVM, type-level?

2010-12-07 Thread Lally Singh
On Tue, Dec 7, 2010 at 1:31 PM, Henning Thielemann
 wrote:
>
> On Tue, 7 Dec 2010, Lally Singh wrote:
>
>> Hey all,
>>
>>  I'm generating a structure definition from input, and would like to
>> generate some LLVM code that can use it.  I see an 'alloca' function
>> in LLVM.Core that may do the trick, but takes a static type (Ptr a),
>> which I wouldn't have.  Is there a dynamic variant?  I'm currently
>> generating a TypeDesc Struct type.
>
>  How much flexibility do you need? Is the user really allowed to specify an
> arbitrary 'struct' declaration? This could be a security hole.
>  If you really want it, I think you would have to use existential
> quantification in order to construct a user defined type at runtime.

Yeah, the program will take in a declaration of a (basic) struct, with
doubles, floats, and integer members.  It'll generate an LLVM program
that'll read that sort of struct from a shared memory segment.

>> Also, is everything under LLVM.Core.* private (not LLVM.Core, but
>> LLVM.Core.Util,etc)?  I saw from some blog posts that Core.Util has a
>> function for (I think) getting the a function's parameters, but I
>> can't seem to find a way to access it.  Is there another way to get
>> the arguments to a function?
>
> I do not understand. The example you posted recently, was a function with
> parameters. Isn't that what you need?

I'd like to get the runtime arguments of a function.  In my case,
main()'s command-line arguments to get the shared-memory ID.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] LLVM, type-level?

2010-12-07 Thread Lally Singh
Hey all,

  I'm generating a structure definition from input, and would like to
generate some LLVM code that can use it.  I see an 'alloca' function
in LLVM.Core that may do the trick, but takes a static type (Ptr a),
which I wouldn't have.  Is there a dynamic variant?  I'm currently
generating a TypeDesc Struct type.

Also, is everything under LLVM.Core.* private (not LLVM.Core, but
LLVM.Core.Util,etc)?  I saw from some blog posts that Core.Util has a
function for (I think) getting the a function's parameters, but I
can't seem to find a way to access it.  Is there another way to get
the arguments to a function?

Thanks for your help,

-Lally

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Lally Singh
No wait, sorry.

buildReaderFun :: String -> CodeGenModule (Function (IO ()))
buildReaderFun nm = do
  puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr
Word8 -> IO Word32)
  let callPuts greetz = createFunction ExternalLinkage $ do
  tmp <- getElementPtr greetz (0 :: Word32,(0 :: Word32, ()))
  call puts  tmp -- Throw away return value.
  ret ()
  withStringNul nm callPuts

Is that how it's intended?

Cheers,
-Lally


On Sun, Dec 5, 2010 at 3:35 PM, Lally Singh  wrote:
> Thanks for your help.  Replying inline
>
> On Sun, Dec 5, 2010 at 1:28 PM, Henning Thielemann
>  wrote:
>>
>> On Sun, 5 Dec 2010, Lally Singh wrote:
>>
>>> Hey all, I'm trying to get started generating LLVM code, but I'm
>>> getting a rather cryptic error.
>>
>> Btw. there is haskell-l...@projects.haskell.org
>>
>>> buildReaderFun :: String -> CodeGenModule (Function (IO ()))
>>> buildReaderFun nm = do
>>>  puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr
>>> Word8 -> IO Word32)
>>>  greetz <- createStringNul nm
>>>  func <- createFunction ExternalLinkage $ do
>>>   tmp <- getElementPtr0 greetz (0 :: Word32, ())
>>
>> You have to add a type annotation to greetz like
>>   (greetz :: Array D42 Word8)
>>  which limits your string to a length of 42 bytes.
>>
>> If you do not know the length, better use withStringNul.
>> I implemented the current behavior, because the former implementation was
>> unsafe.
>
> I'm sorry, the type signature for withStringNul is over my head.
> withStringNul ::
>   String ->
>   (forall n. (Nat n) => Global (Array n Word8) -> CodeGenModule a) ->
>   CodeGenModule a
>
> On the LLVM side, I'm looking to simply create a string constant I can
> pass in, such as ConstantArray::get(..).
>
> I *think* withStringNul will generate code to build a runtime-length
> determined string?   Sorry, I'm a little thick.
>
>>>   call puts  tmp -- Throw away return value.
>>>   ret ()
>>>  return func
>>>
>>> My attempts at figuring out what type-level has to do with this, and
>>> how to satisfy it have so far proven unsuccessful.
>>
>> type-level provides type level integers, and thus allows for static checking
>> of sizes, such as the number of bits of an integer type.
>
> Thanks -- sorry -- I'm guessing it's to make sure we're generating valid code?
>
> Cheers,
> -Lally
>

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Lally Singh
Thanks for your help.  Replying inline

On Sun, Dec 5, 2010 at 1:28 PM, Henning Thielemann
 wrote:
>
> On Sun, 5 Dec 2010, Lally Singh wrote:
>
>> Hey all, I'm trying to get started generating LLVM code, but I'm
>> getting a rather cryptic error.
>
> Btw. there is haskell-l...@projects.haskell.org
>
>> buildReaderFun :: String -> CodeGenModule (Function (IO ()))
>> buildReaderFun nm = do
>>  puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr
>> Word8 -> IO Word32)
>>  greetz <- createStringNul nm
>>  func <- createFunction ExternalLinkage $ do
>>   tmp <- getElementPtr0 greetz (0 :: Word32, ())
>
> You have to add a type annotation to greetz like
>   (greetz :: Array D42 Word8)
>  which limits your string to a length of 42 bytes.
>
> If you do not know the length, better use withStringNul.
> I implemented the current behavior, because the former implementation was
> unsafe.

I'm sorry, the type signature for withStringNul is over my head.
withStringNul ::
   String ->
   (forall n. (Nat n) => Global (Array n Word8) -> CodeGenModule a) ->
   CodeGenModule a

On the LLVM side, I'm looking to simply create a string constant I can
pass in, such as ConstantArray::get(..).

I *think* withStringNul will generate code to build a runtime-length
determined string?   Sorry, I'm a little thick.

>>   call puts  tmp -- Throw away return value.
>>   ret ()
>>  return func
>>
>> My attempts at figuring out what type-level has to do with this, and
>> how to satisfy it have so far proven unsuccessful.
>
> type-level provides type level integers, and thus allows for static checking
> of sizes, such as the number of bits of an integer type.

Thanks -- sorry -- I'm guessing it's to make sure we're generating valid code?

Cheers,
-Lally

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Lally Singh
Hey all, I'm trying to get started generating LLVM code, but I'm
getting a rather cryptic error.

I wanted to create a function that takes a string and generates a
function calling to "puts" with that string as an argument:


buildReaderFun :: String -> CodeGenModule (Function (IO ()))
buildReaderFun nm = do
  puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr
Word8 -> IO Word32)
  greetz <- createStringNul nm
  func <- createFunction ExternalLinkage $ do
tmp <- getElementPtr0 greetz (0 :: Word32, ())
call puts  tmp -- Throw away return value.
ret ()
  return func

(based off of some code at this blog post:
http://augustss.blogspot.com/2009/01/llvm-llvm-low-level-virtual-machine-is.html
)

But, I get this error:

/research/phd/libmet/Listener.hs:16:11:
Ambiguous type variable `n' in the constraint:
  `Data.TypeLevel.Num.Sets.NatI n'
arising from a use of `getElementPtr0'
 at /research/phd/libmet/Listener.hs:16:11-49
Probable fix: add a type signature that fixes these type variable(s)

My attempts at figuring out what type-level has to do with this, and
how to satisfy it have so far proven unsuccessful.

Can anyone shed a little light on what's going on?  Or pointers to
some documentation on any of this?

Cheers,
-Lally

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hGetContents: resource exhausted

2010-08-05 Thread Lally Singh
On Wed, Jul 28, 2010 at 4:21 PM, Donn Cave  wrote:
> Quoth Lally Singh ,
>
>> Ah, it's getting EAGAIN from fds created from prior pipe() calls.  The
>> other sides look like they were DUP2'd to fds 0&1, I'm guessing for a
>> fork/exec().
>
> Well, that isn't a big surprise - it's the way you would expect to
> get EAGAIN.  So ... evidently the GHC runtime is broken somehow on
> OpenSolaris?  I personally have no idea what's going on there, but
> while we're waiting for someone with a clue, here are a couple more
> random things to try:
>
> Have you compiled and run separately?  instead of
>
>> runghc Setup.hs configure
>
>  ghc --make Setup
>  Setup configure
>
> It shouldn't make any difference on its own, but then you can try
> options on the compile, like "ghc -threaded", and runtime flags like
> "Setup +RTS -V0 -RTS"  I suggest that because it cuts down on
> signal interrupts from the runtime, and your symptoms suggest a
> signal interrupt.

That fixed the signal problem!

Sadly that just gets me far enough to Setup +RTS -V0 -RTS build, which
runs ghc, which then dies from the same signal problem :-(
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hGetContents: resource exhausted

2010-07-28 Thread Lally Singh
Ah, it's getting EAGAIN from fds created from prior pipe() calls.  The
other sides look like they were DUP2'd to fds 0&1, I'm guessing for a
fork/exec().

On Mon, Jul 26, 2010 at 10:23 PM, Brandon S Allbery KF8NH
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 7/26/10 21:01 , Donn Cave wrote:
>> Much easier (but not guaranteed to help) you might be able to
>> see the actual error, at the system call level, if you can trace
>> system calls.  The utility for this varies by platform, but
>> e.g. "strace" or "ktrace".
>
> On Solaris it's truss.
>
> - --
> brandon s. allbery     [linux,solaris,freebsd,perl]      allb...@kf8nh.com
> system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
> electrical and computer engineering, carnegie mellon university      KF8NH
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkxOQw4ACgkQIn7hlCsL25WYwQCgxNsPquHR3fyqZxTAGJTeYlfQ
> +wEAn38Z6Phapm4vMgmgp1/0Y/GDqu2Y
> =KanW
> -END PGP SIGNATURE-
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hGetContents: resource exhausted

2010-07-26 Thread Lally Singh
On Mon, Jul 26, 2010 at 7:59 AM, Ben Millwood  wrote:
> On Mon, Jul 26, 2010 at 10:47 AM, Magnus Therning  wrote:
>> On Sun, Jul 25, 2010 at 23:47, Lally Singh  wrote:
>>> Hey all,
>>>
>>>  This is on OpenSolaris.  Simple attempts to build cabal packages
>>> give me this error, and I don't know what it means.  Here's an
>>> example:
>>> [07/25 18:51::la...@sol type-level]$ runghc Setup.hs configure
>>> Configuring type-level-0.2.4...
>>> Setup.hs: fd:8: hGetContents: resource exhausted (Resource temporarily
>>> unavailable)
>>> Setup.hs: fd:8: resource exhausted
>>>
>>> Does anyone know what this means?  I'm trying to just get the llvm
>>> bindings installed (requiring mtl & type-level).
>>
>> A quick guess: you're running out of filedescriptors.
>>
>
> The error gives the descriptor number as 8, so I don't think that's
> terribly likely :)
> Resource temporarily unavailable is the string that corresponds to the
> EAGAIN error, which is typically presented by operations that would
> block being used in non-blocking mode. I have no idea what would cause
> it to be a fatal error in a hGetContents call.

I checked that my ulimit was > 8 :-)  It was 256, I knocked it up to
65,535, but that didn't help.

I've got my own source build of ghc.  Is there anything I can put in
to track down what's going on?

Thanks for all the help folks,

-Lally
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] hGetContents: resource exhausted

2010-07-25 Thread Lally Singh
Hey all,

  This is on OpenSolaris.  Simple attempts to build cabal packages
give me this error, and I don't know what it means.  Here's an
example:
[07/25 18:51::la...@sol type-level]$ runghc Setup.hs configure
Configuring type-level-0.2.4...
Setup.hs: fd:8: hGetContents: resource exhausted (Resource temporarily
unavailable)
Setup.hs: fd:8: resource exhausted

Does anyone know what this means?  I'm trying to just get the llvm
bindings installed (requiring mtl & type-level).

Cheers,
-Lally
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Building gtkhs, OpenSolaris x86

2008-10-03 Thread Lally Singh
Hey folks,

  I know it seems an obtuse OS to build on, but trust me, it's pretty
nice despite the hassles.

  I'm getting these three errors (repeated a few times) while building
gtkhs-0.9.13 on ghc 6.8.3, and was hoping for any suggestions on where
to go from here:

tools/c2hs/base/general/Map.hs:16:7:
Could not find module `Data.Map':
  it is a member of package containers-0.1.0.2, which is hidden
tools/c2hs/base/errors/Errors.hs:44:0:
Failed to load interface for `Position':
  Use -v to see a list of the files searched for.
glib/System/Glib.hs:13:0:
Failed to load interface for `System.Glib.UTFString':
  Use -v to see a list of the files searched for.

What did I screw up?  Is there something else I should load?  Maybe an
older version of gtkhs? ghc?

Thanks for any help!
-- 
H. Lally Singh
Ph.D. Candidate, Computer Science
Virginia Tech
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe